summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmb@php.net>2016-07-28 15:21:48 +0200
committerChristoph M. Becker <cmb@php.net>2016-07-28 15:21:48 +0200
commitee6900c3de68f1b94dfae8e230c7fa755c7fa595 (patch)
tree230f66edfe04dfa13b0172ef4ae1a32567913c90 /ext/mbstring/php_mbregex.c
parent56cdaecb284b2b292ce1ecb076c1f8b041e47a02 (diff)
downloadphp-git-ee6900c3de68f1b94dfae8e230c7fa755c7fa595.tar.gz
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.
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c2
1 files changed, 1 insertions, 1 deletions
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;