From ee6900c3de68f1b94dfae8e230c7fa755c7fa595 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Thu, 28 Jul 2016 15:21:48 +0200 Subject: Fix #72694: mb_ereg_search_setpos does not accept a string's last position Setting the search position immediately behind the last character should be allowed, so we fix this off-by-one error. --- ext/mbstring/php_mbregex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/mbstring/php_mbregex.c') diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index a295f54e4e..9873a85da1 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -1400,7 +1400,7 @@ PHP_FUNCTION(mb_ereg_search_setpos) return; } - if (position < 0 || (MBREX(search_str) != NULL && Z_TYPE_P(MBREX(search_str)) == IS_STRING && position >= Z_STRLEN_P(MBREX(search_str)))) { + if (position < 0 || (MBREX(search_str) != NULL && Z_TYPE_P(MBREX(search_str)) == IS_STRING && position > Z_STRLEN_P(MBREX(search_str)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range"); MBREX(search_pos) = 0; RETURN_FALSE; -- cgit v1.2.1