#36944 [Opn->Csd]: strncmp & negative len
| From: | tony2001@php.net | Date: | Wed, 05 Apr 2006 11:37:46 +0000 |
| Subject: | #36944 [Opn->Csd]: strncmp & negative len | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95334@lists.php.net to get a copy of this message | ||
ID: 36944
Updated by: tony2001@php.net
Reported By: ms419 at freezone dot co dot uk
-Status: Open
+Status: Closed
-Bug Type: Unknown/Other Function
+Bug Type: Strings related
Operating System: Debian
PHP Version: 4.4.2
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Negative string length is not allowed in this function.
I just committed the patch, from now you'll get an error and FALSE in
this case.
Previous Comments:
------------------------------------------------------------------------
[2006-04-02 00:33:02] ms419 at freezone dot co dot uk
Description:
------------
strncmp returns incorrect result given negative len -
fis% php
<?php
var_dump(strncmp('foo_wrapper', '_wrapper', -8));
?>
int(7)
fis%
expected - int(0)
returned - int(7)
Thanks - Jack
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36944&edit=1