pollita Tue Apr 27 15:21:37 2004 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/standard url.c /php-src NEWS Log: MFH BugFix 28187 parse_url does not handle scheme://[0123:4567::89]:12345/etc style IPv6 embedded address URLs http://cvs.php.net/diff.php/php-src/ext/standard/url.c?r1=1.58.2.12&r2=1.58.2.13&ty=u Index: php-src/ext/standard/url.c diff -u php-src/ext/standard/url.c:1.58.2.12 php-src/ext/standard/url.c:1.58.2.13 --- php-src/ext/standard/url.c:1.58.2.12 Wed Dec 3 19:14:50 2003 +++ php-src/ext/standard/url.c Tue Apr 27 15:21:36 2004 @@ -15,7 +15,7 @@ | Author: Jim Winstead <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: url.c,v 1.58.2.12 2003/12/04 00:14:50 iliaa Exp $ */ +/* $Id: url.c,v 1.58.2.13 2004/04/27 19:21:36 pollita Exp $ */ #include <stdlib.h> #include <string.h> @@ -194,7 +194,18 @@ } /* check for port */ - if ((p = memchr(s, ':', (e-s)))) { + if (*s == '[' && *(e-1) == ']') { + /* Short circuit portscan + we're dealing with an + IPv6 embedded address */ + p = s; + } else { + /* memchr is a GNU specific extension + Emulate for wide compatability */ + for(p = e; *p != ':' && p >= s; p--); + } + + if (p >= s && *p == ':') { if (!ret->port) { p++; if (e-p > 5) { /* port cannot be longer then 5 characters */ @@ -213,6 +224,11 @@ } else { p = e; } + + if (*s == '[' && *(p-1) == ']') { + s++; + p--; + } /* check if we have a valid host, if we don't reject the string as url */ if ((p-s) < 1) { http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.649&r2=1.1247.2.650&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.649 php-src/NEWS:1.1247.2.650 --- php-src/NEWS:1.1247.2.649 Sun Apr 25 15:43:30 2004 +++ php-src/NEWS Tue Apr 27 15:21:36 2004 @@ -5,6 +5,7 @@ then 1 character long. (Ilia) - Fixed handling of return values from storred procedures in mssql_execute() with multiple result sets returned. (Frank) +- Fixed bug #28187 (parse_url() not handling embedded IPv6 in URLs). (Sara) - Fixed bug #28147 (Crash with drawing anti-aliased lines). (Derick) - Fixed bug #28112 (sqlite_query() crashing apache on malformed query). (Ilia, Marcus)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php