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

index 155bbf6c69458366a6effac8dff34cf5f7958b74..fd9e85c4e92f91ad51c72beeedfb0f72722a54e9 100644 (file)
@@ -2919,7 +2919,7 @@ PHP_FUNCTION(strripos)
                        u_e = haystack.u + haystack_len - needle_len;
                } else {
                        u_p = haystack.u;
-                       if (-offset > haystack_len || -offset < 0) {
+                       if (-offset > haystack_len || offset < -INT_MAX) {
                                RETURN_FALSE;
                        } else {
                                cu_offset = haystack_len;
@@ -2957,7 +2957,7 @@ PHP_FUNCTION(strripos)
                                e = haystack.s + haystack_len - 1;
                        } else {
                                p = haystack.s;
-                               if (-offset > haystack_len || -offset < 0) {
+                               if (-offset > haystack_len || offset < INT_MAX) {
                                        RETURN_FALSE;
                                } else {
                                        e = haystack.s + haystack_len + offset;
@@ -2988,7 +2988,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(haystack_dup);
                                efree(needle_dup);
                                RETURN_FALSE;