Skip to content

Commit 46566b7

Browse files
committed
Fixed off-by-one in php_url_parse_ex
Change order of condition, previously pointer could be derefrenced before bound check was done.
1 parent 4b48b29 commit 46566b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/url.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
263263
} else {
264264
/* memrchr is a GNU specific extension
265265
Emulate for wide compatability */
266-
for(p = e; *p != ':' && p >= s; p--);
266+
for(p = e; p >= s && *p != ':'; p--);
267267
}
268268

269269
if (p >= s && *p == ':') {

0 commit comments

Comments
 (0)