]> granicus.if.org Git - php/commitdiff
fix MOPB#14
authorStanislav Malyshev <stas@php.net>
Wed, 7 Mar 2007 18:15:46 +0000 (18:15 +0000)
committerStanislav Malyshev <stas@php.net>
Wed, 7 Mar 2007 18:15:46 +0000 (18:15 +0000)
# The error message seems wrong, so maybe better fix is needed

ext/standard/string.c

index ffd47155206acbc12c7829e4b283fd3bd69badf3..97fe4612c384eb20bb63052c2d1fb89632361696 100644 (file)
@@ -5074,7 +5074,7 @@ PHP_FUNCTION(substr_compare)
                offset = (offset < 0) ? 0 : offset;
        }
 
-       if ((offset + len) > s1_len) {
+       if ((offset + len) > s1_len || (offset+len) < 0) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length");
                RETURN_FALSE;
        }