Bug #60801 [Asn->Sus]: strpbrk() mishandles NUL byte
| From: | aharvey@php.net | Date: | Mon, 30 Jan 2012 13:30:22 +0000 |
| Subject: | Bug #60801 [Asn->Sus]: strpbrk() mishandles NUL byte | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-166967@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60801&edit=1
ID: 60801
Updated by: aharvey@php.net
Reported by: dexen dot devries at gmail dot com
Summary: strpbrk() mishandles NUL byte
-Status: Assigned
+Status: Suspended
Type: Bug
Package: Strings related
PHP Version: 5.3.9
Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
Implemented on trunk. This should be straightforward enough to backport to 5.3 and
5.4, but with 5.4 in code freeze at present, I'll have to revisit this a bit after
5.4.0 final is released.
Previous Comments:
------------------------------------------------------------------------
[2012-01-30 13:29:13] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=322934
Log: Fix bug #60801 (strpbrk() mishandles NUL byte) on trunk only for now.
------------------------------------------------------------------------
[2012-01-19 09:37:07] dexen dot devries at gmail dot com
Description:
------------
PHP's strpbrk() passes its string arguments directly to libc strpbrk(), which
considers NUL byte a string-terminatig character rather than a normal part of
the string.
note that, in the test script below, the strpbrk() matches neither the NUL byte,
nor the `a' character (because it occurs after a NUL byte in $haystack), nor
even the `b' character (because it occurs after a NUL byte in $char_list).
Test script:
---------------
$haystack = "foob\x00ar";
$char_list = "a\x00b";
$v = strpbrk($haystack, $char_list);
Expected result:
----------------
$v === "b\x00ar"
Actual result:
--------------
$v === FALSE
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60801&edit=1