This is an automated email from the ASF dual-hosted git repository.
bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new 048df1e3c Names end before the first NULL (not the last)
new 837eab258 Merge pull request #194 from keithc-ca/tar
048df1e3c is described below
commit 048df1e3cfbc0da8a9e6a063a1f476804f2e4f06
Author: Keith W. Campbell <[email protected]>
AuthorDate: Wed Oct 26 13:30:00 2022 -0400
Names end before the first NULL (not the last)
This fixes parsing of archives produced on macOS.
Signed-off-by: Keith W. Campbell <[email protected]>
---
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;
}
}