From 048df1e3cfbc0da8a9e6a063a1f476804f2e4f06 Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Wed, 26 Oct 2022 13:30:00 -0400 Subject: Names end before the first NULL (not the last) This fixes parsing of archives produced on macOS. Signed-off-by: Keith W. Campbell --- src/main/org/apache/tools/tar/TarUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/tar/TarUtils.java b/src/main/org/apache/tools/tar/TarUtils.java index b6e12c4da..f6f103654 100644 --- a/src/main/org/apache/tools/tar/TarUtils.java +++ b/src/main/org/apache/tools/tar/TarUtils.java @@ -286,9 +286,9 @@ public class TarUtils { final ZipEncoding encoding) throws IOException { - int len = length; - for (; len > 0; len--) { - if (buffer[offset + len - 1] != 0) { + int len = 0; + for (; len < length; ++len) { + if (buffer[offset + len] == 0) { break; } } -- cgit v1.2.1