Bug #70480 [NEW]: php_url_parse_ex() buffer overflow read

From: Date: Sun, 13 Sep 2015 06:34:16 +0000
Subject: Bug #70480 [NEW]: php_url_parse_ex() buffer overflow read
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195982@lists.php.net to get a copy of this message
From: yohgaki Operating system: Irrelevant PHP version: Irrelevant Package: URL related Bug Type: Bug Bug description:php_url_parse_ex() buffer overflow read Description: ------------ php_url_prase_ex() read buffer exceeding its limits and segfaults. PHP function parse_url() is not affected since PHP string is terminated by null char always. Patch to fix this: @@ -319,8 +320,9 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) nohost: if ((p = memchr(s, '?', (ue - s)))) { - pp = strchr(s, '#'); + pp = memchr(s, '#', (ue - s)); if (pp && pp < p) { if (pp - s) { Test script: --------------- N/A This bug only appears only when php_url_prase_ex() is called internally. -- Edit bug report at https://bugs.php.net/bug.php?id=70480&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70480&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70480&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70480&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70480&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70480&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70480&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70480&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70480&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70480&r=support Expected behavior: https://bugs.php.net/fix.php?id=70480&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70480&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70480&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70480&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70480&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70480&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70480&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70480&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70480&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70480&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70480&r=mysqlcfg

« previous php.bugs (#195982) next »