]> granicus.if.org Git - php/commitdiff
Fixed valgrind issue in mb_ereg_replace_variation1.phpt
authorXinchen Hui <laruence@php.net>
Thu, 29 Jan 2015 11:28:46 +0000 (19:28 +0800)
committerXinchen Hui <laruence@php.net>
Thu, 29 Jan 2015 11:28:46 +0000 (19:28 +0800)
ext/mbstring/php_mbregex.c

index 59238fda39e4195d993c73a60b07d1ff0096ac62..783a8c98a5945368c8a09dd6944e5fc51d219663 100644 (file)
@@ -810,7 +810,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
        OnigUChar *pos;
        OnigUChar *string_lim;
        char *description = NULL;
-       char pat_buf[2];
+       char pat_buf[4];
 
        const mbfl_encoding *enc;
 
@@ -861,6 +861,8 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
                convert_to_long_ex(arg_pattern_zval);
                pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval);
                pat_buf[1] = '\0';
+               pat_buf[2] = '\0';
+               pat_buf[3] = '\0';
 
                arg_pattern = pat_buf;
                arg_pattern_len = 1;