From bf6873a18e3b6b00f82a645c0893a281ae8eadb8 Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Mon, 21 Sep 2020 12:58:29 +0900 Subject: [PATCH] Fix out-of-bounds write Fixes CVE-2020-26159. Backported from . --- ext/mbstring/oniguruma/src/regcomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mbstring/oniguruma/src/regcomp.c b/ext/mbstring/oniguruma/src/regcomp.c index 69d4b95f95..4f68af2345 100644 --- a/ext/mbstring/oniguruma/src/regcomp.c +++ b/ext/mbstring/oniguruma/src/regcomp.c @@ -5603,7 +5603,7 @@ concat_opt_exact_str(OptStr* to, UChar* s, UChar* end, OnigEncoding enc) for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) { len = enclen(enc, p); - if (i + len > OPT_EXACT_MAXLEN) break; + if (i + len >= OPT_EXACT_MAXLEN) break; for (j = 0; j < len && p < end; j++) to->s[i++] = *p++; } -- 2.50.1