aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorWilliam Djupström <william@deepztream.com>2020-06-08 13:38:33 +0200
committerRob Landley <rob@landley.net>2020-06-08 07:15:49 -0500
commit7fe1bdfb5fc05f344e1a8f0ce1c89aa7bfea9a08 (patch)
tree8be2ba78c3344b22366f116c06e61f2ed065f2e8 /toys/posix
parentf224ac56d997a60dda25e4dbf33799cabecd721e (diff)
downloadtoybox-7fe1bdfb5fc05f344e1a8f0ce1c89aa7bfea9a08.tar.gz
tar: fix extracting long file paths
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/tar.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/tar.c b/toys/posix/tar.c
index 9642fbe6..77dd6fe9 100644
--- a/toys/posix/tar.c
+++ b/toys/posix/tar.c
@@ -590,7 +590,7 @@ static void unpack_tar(char *first)
else if (tar.type == 'L') alloread(&TT.hdr.name, TT.hdr.size);
else if (tar.type == 'x') {
char *p, *buf = 0;
- int i, len, n;
+ int i, len, n = 0;
// Posix extended record "LEN NAME=VALUE\n" format
alloread(&buf, TT.hdr.size);
@@ -601,7 +601,7 @@ static void unpack_tar(char *first)
break;
}
p[len-1] = 0;
- if (i == 2) {
+ if (n) {
TT.hdr.name = xstrdup(p+n);
break;
}