From: oes Date: Tue, 8 Oct 2002 16:22:28 +0000 (+0000) Subject: Bugfix: Need to check validity of backreferences explicitly, because when max_matches... X-Git-Tag: v_3_0_1~112 X-Git-Url: http://www.privoxy.org/gitweb/@user-manual@?a=commitdiff_plain;h=bd7a2897f45eae6d28ebfcaff2f1ea151c486d8e;p=privoxy.git Bugfix: Need to check validity of backreferences explicitly, because when max_matches are reached and matches is expanded, realloc() does not zero the memory. Fixes Bug # 606227 --- diff --git a/pcrs.c b/pcrs.c index 49e8bb99..5780188b 100644 --- a/pcrs.c +++ b/pcrs.c @@ -1,4 +1,4 @@ -const char pcrs_rcs[] = "$Id: pcrs.c,v 1.19 2002/03/08 14:47:48 oes Exp $"; +const char pcrs_rcs[] = "$Id: pcrs.c,v 1.19.2.1 2002/08/10 11:23:40 oes Exp $"; /********************************************************************* * @@ -33,6 +33,10 @@ const char pcrs_rcs[] = "$Id: pcrs.c,v 1.19 2002/03/08 14:47:48 oes Exp $"; * * Revisions : * $Log: pcrs.c,v $ + * Revision 1.19.2.1 2002/08/10 11:23:40 oes + * Include prce.h via project.h, where the appropriate + * source will have been selected + * * Revision 1.19 2002/03/08 14:47:48 oes * Cosmetics * @@ -915,7 +919,9 @@ int pcrs_execute(pcrs_job *job, char *subject, size_t subject_length, char **res if (k != job->substitute->backrefs /* ..in legal range.. */ && job->substitute->backref[k] < PCRS_MAX_SUBMATCHES + 2 - /* ..and referencing a nonempty match.. */ + /* ..and referencing a real submatch.. */ + && job->substitute->backref[k] < matches[i].submatches + /* ..that is nonempty.. */ && matches[i].submatch_length[job->substitute->backref[k]] > 0) { /* ..copy the submatch that is ref'd. */