From: Fabian Keil <fk@fabiankeil.de>
Date: Sun, 8 May 2016 10:45:51 +0000 (+0000)
Subject: pcrs_compile_replacement(): Silence a coverity warning (CID #161203)
X-Git-Tag: v_3_0_25~41
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/static/developer-manual/@default-cgi@toggle?a=commitdiff_plain;h=138747bd3f178c448de25dce2ca1d90de6e0f6cb;p=privoxy.git

pcrs_compile_replacement(): Silence a coverity warning (CID #161203)
---

diff --git a/pcrs.c b/pcrs.c
index 156ae988..93f58278 100644
--- 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;