summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2011-11-21 19:15:18 +0000
committerFelipe Pena <felipe@php.net>2011-11-21 19:15:18 +0000
commit97659d4842f21decff68dabb5072834703e21485 (patch)
tree12889090c03a4088704a38fc7546f8983c2ffd55 /ext/mbstring/php_mbregex.c
parent034ba714cfdc06d9bd2f2c04dd4ecdd9e0ce0c78 (diff)
downloadphp-git-97659d4842f21decff68dabb5072834703e21485.tar.gz
- Fixed possible crash in mb_ereg_search_init() using empty pattern
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index ba71835478..d77ff95bfa 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1245,14 +1245,19 @@ PHP_FUNCTION(mb_ereg_search_init)
{
size_t argc = ZEND_NUM_ARGS();
zval *arg_str;
- char *arg_pattern, *arg_options;
- int arg_pattern_len, arg_options_len;
+ char *arg_pattern = NULL, *arg_options = NULL;
+ int arg_pattern_len = 0, arg_options_len = 0;
OnigSyntaxType *syntax = NULL;
OnigOptionType option;
if (zend_parse_parameters(argc TSRMLS_CC, "z|ss", &arg_str, &arg_pattern, &arg_pattern_len, &arg_options, &arg_options_len) == FAILURE) {
return;
}
+
+ if (arg_pattern_len == 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty pattern");
+ RETURN_FALSE;
+ }
option = MBREX(regex_default_options);
syntax = MBREX(regex_default_syntax);