]> granicus.if.org Git - php/commitdiff
Fixed off-by-one in php_url_parse_ex
authorMateusz Kocielski <shm@php.net>
Tue, 18 Mar 2014 07:48:41 +0000 (08:48 +0100)
committerMateusz Kocielski <shm@php.net>
Tue, 18 Mar 2014 07:48:41 +0000 (08:48 +0100)
Change order of condition, previously pointer could be derefrenced before
bound check was done.

ext/standard/url.c

index fd5bcb402e2d37189de961fedf7197d6e0ea23d8..1c158071e14f6c16db67e43ec60a077bd8b6053d 100644 (file)
@@ -263,7 +263,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
        } else {
                /* memrchr is a GNU specific extension
                   Emulate for wide compatability */
-               for(p = e; *p != ':' && p >= s; p--);
+               for(p = e; p >= s && *p != ':'; p--);
        }
 
        if (p >= s && *p == ':') {