File bsc1202436-2.patch of Package tar.28079

From 5e8a915b16c5f06d2a16d98cdc2af666199caabb Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Sat, 11 Feb 2023 14:21:05 +0200
Subject: Changes in extended header decoder

* src/xheader.c (decode_time): Fix error detection.
(raw_path_decoder): Ignore empty paths.
---
 src/xheader.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Index: tar-1.27.1/src/xheader.c
===================================================================
--- tar-1.27.1.orig/src/xheader.c
+++ tar-1.27.1/src/xheader.c
@@ -1094,6 +1094,12 @@ decode_time (struct timespec *ts, char c
 		keyword, arg));
       return false;
     }
+  if (*arg_lim)
+    {
+      ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
+	      keyword, arg));
+      return false;
+    }
 
   *ts = t;
   return true;
@@ -1285,9 +1291,12 @@ path_decoder (struct tar_stat_info *st,
 	      char const *arg,
 	      size_t size __attribute__((unused)))
 {
-  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);
+    }
 }
 
 static void
openSUSE Build Service is sponsored by