]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Changes in extended header decoder
authorSergey Poznyakoff <gray@gnu.org>
Sat, 11 Feb 2023 12:21:05 +0000 (14:21 +0200)
committerSergey Poznyakoff <gray@gnu.org>
Sat, 11 Feb 2023 12:21:05 +0000 (14:21 +0200)
* src/xheader.c (decode_time): Fix error detection.
(raw_path_decoder): Ignore empty paths.

src/xheader.c

index 7ff216b8028483c1240f464d52e124eaae474490..a195f3e53e5efb0d221b6d5900b4c64a74f70ddd 100644 (file)
@@ -1059,6 +1059,12 @@ decode_time (struct timespec *ts, char const *arg, char const *keyword)
                keyword, arg));
       return false;
     }
+  if (*arg_lim)
+    {
+      ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
+             keyword, arg));
+      return false;
+    }
 
   *ts = t;
   return true;
@@ -1247,9 +1253,12 @@ path_coder (struct tar_stat_info const *st, char const *keyword,
 static void
 raw_path_decoder (struct tar_stat_info *st, char const *arg)
 {
-  decode_string (&st->orig_file_name, arg);
-  decode_string (&st->file_name, arg);
-  st->had_trailing_slash = strip_trailing_slashes (st->file_name);
+  if (*arg)
+    {
+      decode_string (&st->orig_file_name, arg);
+      decode_string (&st->file_name, arg);
+      st->had_trailing_slash = strip_trailing_slashes (st->file_name);
+    }
 }