From 066e3b3e50bdfeb03fc98a4b69b907a0bc5f9ef5 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 22 May 2004 06:05:24 +0000 Subject: [PATCH] Changed order of list-clearing loop in pop_local_excludes() to avoid accessing already-freed memory. --- filter.diff | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/filter.diff b/filter.diff index 23c4225..194eba3 100644 --- a/filter.diff +++ b/filter.diff @@ -29,8 +29,8 @@ for the current dir because its name contained a slash. ..wayne.. ---- exclude.c 21 May 2004 09:59:49 -0000 1.81 -+++ exclude.c 21 May 2004 23:49:03 -0000 +--- exclude.c 22 May 2004 05:32:20 -0000 1.82 ++++ exclude.c 22 May 2004 06:02:55 -0000 @@ -30,13 +30,56 @@ extern int verbose; extern int eol_nulls; extern int list_only; @@ -252,7 +252,7 @@ for the current dir because its name contained a slash. + struct exclude_list_struct *ap; + int i; + -+ for (i = 0; i < mergelist_cnt; i++) { ++ for (i = mergelist_cnt; i-- > 0; ) { + struct exclude_struct *ex = mergelist_parents[i]; + struct exclude_list_struct *lp = ex->u.mergelist; + @@ -312,7 +312,7 @@ for the current dir because its name contained a slash. if (check_one_exclude(name, ent, name_is_dir)) { report_exclude_result(name, ent, name_is_dir, listp->debug_type); -@@ -254,11 +437,16 @@ static const char *get_exclude_tok(const +@@ -253,11 +436,16 @@ static const char *get_exclude_tok(const p = (const char *)s; } @@ -331,7 +331,7 @@ for the current dir because its name contained a slash. s += 2; } else if (xflags & XFLG_DEF_INCLUDE) mflags |= MATCHFLG_INCLUDE; -@@ -307,11 +495,42 @@ void add_exclude(struct exclude_list_str +@@ -306,11 +494,42 @@ void add_exclude(struct exclude_list_str continue; } @@ -375,7 +375,7 @@ for the current dir because its name contained a slash. mflags & MATCHFLG_INCLUDE ? "in" : "ex"); } } -@@ -403,7 +622,11 @@ void send_exclude_list(int f) +@@ -402,7 +621,11 @@ void send_exclude_list(int f) if (ent->match_flags & MATCHFLG_INCLUDE) { write_int(f, l + 2); write_buf(f, "+ ", 2); @@ -388,7 +388,7 @@ for the current dir because its name contained a slash. write_int(f, l + 2); write_buf(f, "- ", 2); } else -@@ -444,6 +667,7 @@ void add_cvs_excludes(void) +@@ -443,6 +666,7 @@ void add_cvs_excludes(void) char fname[MAXPATHLEN]; char *p; @@ -397,7 +397,7 @@ for the current dir because its name contained a slash. XFLG_WORD_SPLIT | XFLG_WORDS_ONLY); --- flist.c 21 May 2004 23:22:14 -0000 1.225 -+++ flist.c 21 May 2004 23:49:04 -0000 ++++ flist.c 22 May 2004 06:02:55 -0000 @@ -39,8 +39,6 @@ extern int module_id; extern int ignore_errors; extern int numeric_ids; @@ -490,7 +490,7 @@ for the current dir because its name contained a slash. } --- rsync.h 16 May 2004 07:28:24 -0000 1.204 -+++ rsync.h 21 May 2004 23:49:05 -0000 ++++ rsync.h 22 May 2004 06:02:56 -0000 @@ -496,11 +496,16 @@ struct map_struct { #define MATCHFLG_INCLUDE (1<<4) /* this is an include, not an exclude */ #define MATCHFLG_DIRECTORY (1<<5) /* this matches only directories */ @@ -510,7 +510,7 @@ for the current dir because its name contained a slash. struct exclude_list_struct { --- rsync.yo 21 May 2004 09:44:32 -0000 1.170 -+++ rsync.yo 21 May 2004 23:49:05 -0000 ++++ rsync.yo 22 May 2004 06:02:57 -0000 @@ -1090,6 +1090,72 @@ itemize( it would be excluded by the "*") ) -- 2.34.1