#207: Out-of-bounds write

This commit is contained in:
tabudz 2025-02-26 19:40:49 +08:00
parent 4366359e4e
commit 51a0125149

View File

@ -5222,7 +5222,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++;
}