summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index aba93f5059..c329f9e16a 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1579,6 +1579,10 @@ PHP_FUNCTION(strrpos)
RETURN_FALSE;
}
+ if ((haystack_len == 0) || (needle_len == 0)) {
+ RETURN_FALSE;
+ }
+
if (offset >= 0) {
p = haystack + offset;
e = haystack + haystack_len - needle_len;
@@ -1615,6 +1619,10 @@ PHP_FUNCTION(strripos)
RETURN_FALSE;
}
+ if ((haystack_len == 0) || (needle_len == 0)) {
+ RETURN_FALSE;
+ }
+
needle_dup = estrndup(needle, needle_len);
php_strtolower(needle_dup, needle_len);
haystack_dup = estrndup(haystack, haystack_len);