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
commit18768584e2b236b7fe798449695c2c0363c947d9 (patch)
treebb3b969bbcdfc227685022fe766d35e4649f2b5e /ext/mbstring/php_mbregex.c
parent3781026cb832e663871e0cbb8a4154f4f6551600 (diff)
downloadphp-git-18768584e2b236b7fe798449695c2c0363c947d9.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 f3fd96a556..9bc87a59bd 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1310,14 +1310,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);