summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-06-06 21:53:54 +0000
committerAntony Dovgal <tony2001@php.net>2007-06-06 21:53:54 +0000
commit2041566a124b09a1912142fc246764cd1504db99 (patch)
tree0b9fbac3dbfbd2d2778c08bd028a4bf0526bb7bb /ext/standard/string.c
parent9295456f019042b760fd1f3660a724e9eab70f5c (diff)
downloadphp-git-2041566a124b09a1912142fc246764cd1504db99.tar.gz
MFH
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index d22e85924d..acf6a8d526 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -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");