summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bodewig <bodewig@apache.org>2022-11-07 18:33:56 +0100
committerGitHub <noreply@github.com>2022-11-07 18:33:56 +0100
commit837eab258e16543cdaee6453538f28063f7afb36 (patch)
tree603558989605fb02f900c065653a0b4a8736a9c3
parent15ed7c87e5081d781d123b8ccce622bb35c8b46f (diff)
parent048df1e3cfbc0da8a9e6a063a1f476804f2e4f06 (diff)
downloadant-837eab258e16543cdaee6453538f28063f7afb36.tar.gz
Merge pull request #194 from keithc-ca/tar
Names end before the first NULL (not the last)
-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;
}
}