Skip to content

Commit 999a355

Browse files
committed
Fixed(attempt to) bug #72405 (mb_ereg_replace - mbc_to_code (oniguruma) - oob read access)
according to ext/mbstring/oniguruma/enc/utf8.c, max bytes are 6
1 parent 3d56418 commit 999a355

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
?? ??? 2016 PHP 7.0.9
44

55
- Mbstring:
6+
. Fixed bug #72405 (mb_ereg_replace - mbc_to_code (oniguruma) -
7+
oob read access). (Laruence)
68
. Fixed bug #72399 (Use-After-Free in MBString (search_re)). (Laruence)
79

810
- Standard:

ext/mbstring/php_mbregex.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
811811
OnigUChar *pos;
812812
OnigUChar *string_lim;
813813
char *description = NULL;
814-
char pat_buf[4];
814+
char pat_buf[6];
815815

816816
const mbfl_encoding *enc;
817817

@@ -864,6 +864,8 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
864864
pat_buf[1] = '\0';
865865
pat_buf[2] = '\0';
866866
pat_buf[3] = '\0';
867+
pat_buf[4] = '\0';
868+
pat_buf[5] = '\0';
867869

868870
arg_pattern = pat_buf;
869871
arg_pattern_len = 1;

0 commit comments

Comments
 (0)