]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
tar: fix --exclude-vcs-ignores memory
authorAurélien Martin <amartin@witekio.com>
Fri, 7 Oct 2022 19:08:40 +0000 (21:08 +0200)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 7 Oct 2022 22:25:36 +0000 (15:25 -0700)
The function frees the patterns' wordsplit structure without asking
add_exclude to reallocate the strings.  In many cases, this leads to
each file name in the directory being checked against the memory
location where it just got reallocated.
* src/exclist.c: Use EXCLUDE_ALLOC.
Copyright-paperwork-exempt: Yes

src/exclist.c

index 80450bb79690c7ae8e073b59e2c88e2fc9203f54..1be08cbea7a99357a203bca299090d12d2a52bfe 100644 (file)
@@ -203,6 +203,7 @@ cvs_addfn (struct exclude *ex, char const *pattern, int options, void *data)
   struct wordsplit ws;
   size_t i;
 
+  options |= EXCLUDE_ALLOC;
   if (wordsplit (pattern, &ws,
                 WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_SQUEEZE_DELIMS))
     return;