]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Disallow --one-top-level=''.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 7 Apr 2026 18:05:23 +0000 (11:05 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 8 Apr 2026 16:07:12 +0000 (09:07 -0700)
* src/tar.c (decode_options): Do not accept an empty string
as a relative file name.

src/tar.c

index 1ee5ed418db5949c6a840fa1bbb56b7748996764..1df9460c6c637794ecd533e30cbb3ad9a66163df 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -2688,7 +2688,9 @@ decode_options (int argc, char **argv)
                        "please set it explicitly with --one-top-level=DIR"));
        }
 
-      if (one_top_level_dir && !IS_RELATIVE_FILE_NAME (one_top_level_dir))
+      if (one_top_level_dir
+         && ! (*one_top_level_dir
+               && IS_RELATIVE_FILE_NAME (one_top_level_dir)))
        paxusage(_("--one-top-level=DIR must use a relative file name"));
     }