pcrs_compile_replacement(): Silence a coverity warning (CID #161203)
authorFabian Keil <fk@fabiankeil.de>
Sun, 8 May 2016 10:45:51 +0000 (10:45 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 8 May 2016 10:45:51 +0000 (10:45 +0000)
pcrs.c

diff --git a/pcrs.c b/pcrs.c
index 156ae98..93f5827 100644 (file)
--- a/pcrs.c
+++ b/pcrs.c
@@ -1,4 +1,4 @@
-const char pcrs_rcs[] = "$Id: pcrs.c,v 1.47 2015/01/24 16:40:59 fabiankeil Exp $";
+const char pcrs_rcs[] = "$Id: pcrs.c,v 1.48 2015/12/27 12:45:46 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/pcrs.c,v $
@@ -376,7 +376,9 @@ static pcrs_substitute *pcrs_compile_replacement(const char *replacement, int tr
             }
 
             /* Valid and in range? -> record */
-            if (0 <= r->backref[l] && r->backref[l] < PCRS_MAX_SUBMATCHES + 2)
+            if ((0 <= r->backref[l]) &&
+               (r->backref[l] < PCRS_MAX_SUBMATCHES + 2) &&
+               (l < PCRS_MAX_SUBMATCHES - 1))
             {
                r->backref_count[r->backref[l]] += 1;
                r->block_offset[++l] = k;