From: Moriyoshi Koizumi Date: Tue, 21 Jan 2003 19:31:07 +0000 (+0000) Subject: Fixed mb_ereg_search() segfault that occurs when the function is called X-Git-Tag: PHP_5_0_dev_before_13561_fix~98 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a723fcb4e18c185a9cb49f59bc5bd52c27f0d79;p=php Fixed mb_ereg_search() segfault that occurs when the function is called before a string to be searched is passed by mb_ereg_search_init() --- diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index ecf8183e34..5997d98acc 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -855,7 +855,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) pos = MBSTRG(search_pos); str = NULL; len = 0; - if (Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING){ + if (MBSTRG(search_str) != NULL && Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING){ str = (unsigned char *)Z_STRVAL_PP(MBSTRG(search_str)); len = Z_STRLEN_PP(MBSTRG(search_str)); }