Blob Blame History Raw
From 3603d78f0a3dc80e4d450509120c26a5ffcd293b Mon Sep 17 00:00:00 2001
From: "K.Kosako" <kkosako0@gmail.com>
Date: Tue, 20 Oct 2020 11:52:27 +0900
Subject: [PATCH] #221: revert cbe9f8b and 8155473: Out-of-bounds write in #207
 (Issues found with Coverity) is fake

---
 src/regcomp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/regcomp.c b/src/regcomp.c
index 30b982bb..7aee715f 100644
--- a/src/regcomp.c
+++ b/src/regcomp.c
@@ -6238,7 +6238,7 @@ concat_opt_exact(OptStr* to, OptStr* add, OnigEncoding enc)
   end = p + add->len;
   for (i = to->len; p < end; ) {
     len = enclen(enc, p);
-    if (i + len >= OPT_EXACT_MAXLEN) {
+    if (i + len > OPT_EXACT_MAXLEN) {
       r = 1; /* 1:full */
       break;
     }
@@ -6264,7 +6264,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++;
   }