com php-src: Follow up patch regarding bug #74216, see bug #74429: main/streams/xp_socket.c

[email protected] (Anatol Belski)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    cda7dcf4cacef3346f9dc2a4dc947e6a74769259
Author:    Sara Golemon <[email protected]>         Tue, 25 Apr 2017 12:52:48 +0200
Committer: Anatol Belski <[email protected]>      Tue, 25 Apr 2017 12:52:48 +0200
Parents:   6afcd6c86abc59719aad286bab29ee51508eba9c
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=cda7dcf4cacef3346f9dc2a4dc947e6a74769259

Log:
Follow up patch regarding bug #74216, see bug #74429

While the case in bug #74429 is not documented and is only worky due to
an implementation bug, the strength seems to breach some real world
apps. Given this patch doesn't impact the initial security fix for
bug #74216, it is reasonable to let the apps keep working. As mentioned
in the ticket, this behavior is a subject to change in future versions
and should not be abused.

Bugs:
https://bugs.php.net/74216
https://bugs.php.net/74429

Changed paths:
  M  main/streams/xp_socket.c


Diff:
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 3ff6478..92be333 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -581,7 +581,7 @@ static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *po
 			return NULL;
 		}
 		*portno = strtol(p + 2, &e, 10);
-		if (e && *e) {
+		if (e && *e && *e != '/') {
 			if (get_err) {
 				*err = strpprintf(0, "Failed to parse address \"%s\"", str);
 			}
@@ -600,7 +600,7 @@ static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *po
 	if (colon) {
 		char *e = NULL;
 		*portno = strtol(colon + 1, &e, 10);
-		if (!e || !*e) {
+		if (!e || !*e || *e == '/') {
 			return estrndup(str, colon - str);
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.