From: Aurélien Martin Date: Fri, 7 Oct 2022 19:08:40 +0000 (+0200) Subject: tar: fix --exclude-vcs-ignores memory X-Git-Tag: v1.35~47 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7324326b1df67831b39a597eb10f67a5369aa189;p=thirdparty%2Ftar.git tar: fix --exclude-vcs-ignores memory 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 --- diff --git a/src/exclist.c b/src/exclist.c index 80450bb7..1be08cbe 100644 --- a/src/exclist.c +++ b/src/exclist.c @@ -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;