From 7fe1bdfb5fc05f344e1a8f0ce1c89aa7bfea9a08 Mon Sep 17 00:00:00 2001 From: William Djupström Date: Mon, 8 Jun 2020 13:38:33 +0200 Subject: tar: fix extracting long file paths --- toys/posix/tar.c | 4 ++-- 1 file 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; } -- cgit v1.2.3