summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2023-02-11 14:21:05 +0200
committerSergey Poznyakoff <gray@gnu.org>2023-02-11 14:21:05 +0200
commit5e8a915b16c5f06d2a16d98cdc2af666199caabb (patch)
treeaab81ca7ab41978ff969e0e587425fe7fcacc41f
parentedf38d13a47becec81b2c3a2b74f54771e1cbee4 (diff)
downloadtar-5e8a915b16c5f06d2a16d98cdc2af666199caabb.tar.gz
Changes in extended header decoder
* src/xheader.c (decode_time): Fix error detection. (raw_path_decoder): Ignore empty paths.
-rw-r--r--src/xheader.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/xheader.c b/src/xheader.c
index 7ff216b8..a195f3e5 100644
--- a/src/xheader.c
+++ b/src/xheader.c
@@ -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);
+ }
}