]> granicus.if.org Git - php/commitdiff
MFH
authorAntony Dovgal <tony2001@php.net>
Wed, 6 Jun 2007 21:53:54 +0000 (21:53 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 6 Jun 2007 21:53:54 +0000 (21:53 +0000)
ext/standard/string.c

index d22e85924d8ae9940132fe909a99768e2755b217..acf6a8d526b89f106a28e16ff0bec4d564ab4958 100644 (file)
@@ -1860,12 +1860,11 @@ PHP_FUNCTION(strripos)
                        e = haystack + haystack_len - 1;
                } else {
                        p = haystack;
-                       if (-offset > haystack_len || -offset < 0) {
+                       if (-offset > haystack_len || offset < -INT_MAX) {
                                php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string");
                                RETURN_FALSE;
-                       } else {
-                               e = haystack + haystack_len + offset;
                        }
+                       e = haystack + haystack_len + offset;
                }
                /* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */
                *ord_needle = tolower(*needle);
@@ -1893,7 +1892,7 @@ PHP_FUNCTION(strripos)
                p = haystack_dup + offset;
                e = haystack_dup + haystack_len - needle_len;
        } else {
-               if (-offset > haystack_len || -offset < 0) {
+               if (-offset > haystack_len || offset < -INT_MAX) {
                        efree(needle_dup);
                        efree(haystack_dup);
                        php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string");