summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith W. Campbell <keithc@ca.ibm.com>2022-10-26 13:30:00 -0400
committerKeith W. Campbell <keithc@ca.ibm.com>2022-10-26 13:30:10 -0400
commit048df1e3cfbc0da8a9e6a063a1f476804f2e4f06 (patch)
tree603558989605fb02f900c065653a0b4a8736a9c3
parent15ed7c87e5081d781d123b8ccce622bb35c8b46f (diff)
downloadant-048df1e3cfbc0da8a9e6a063a1f476804f2e4f06.tar.gz
Names end before the first NULL (not the last)
This fixes parsing of archives produced on macOS. Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
-rw-r--r--src/main/org/apache/tools/tar/TarUtils.java6
1 files 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;
}
}