From: Paul Eggert Date: Tue, 7 Apr 2026 18:11:21 +0000 (-0700) Subject: --one-top-level now keeps "../" and ".../" X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=90dec1cc53b8297fafc710e5cc57c8ba8a1fb9bb;p=thirdparty%2Ftar.git --one-top-level now keeps "../" and ".../" * src/list.c (enforce_one_top_level): Do not strip prefixes like "../" (which should not be allowed unless -P) and ".../" (which are ordinary file names). The "../" not being allowed should be addressed in a different way. --- diff --git a/src/list.c b/src/list.c index 8e9caf5c..14050cfb 100644 --- a/src/list.c +++ b/src/list.c @@ -120,8 +120,16 @@ enforce_one_top_level (char **pfile_name) char *file_name = *pfile_name; char *p; - for (p = file_name; *p && (ISSLASH (*p) || *p == '.'); p++) - ; + for (p = file_name; ; p++) + { + bool dot = p[0] == '.'; + if (!ISSLASH (p[dot])) + { + p += dot & !p[dot]; + break; + } + p += dot; + } if (*p) {