You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2017/10/06 17:12:03 UTC

[2/3] commons-compress git commit: Let parseName stop at first NUL

Let parseName stop at first NUL

Fixes COMPRESS-421


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/469cf4d8
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/469cf4d8
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/469cf4d8

Branch: refs/heads/master
Commit: 469cf4d886f9a184168ba2d179899a600725d4c4
Parents: 1c016cb
Author: Roel Spilker <r....@gmail.com>
Authored: Fri Oct 6 00:50:23 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Oct 6 19:08:25 2017 +0200

----------------------------------------------------------------------
 .../org/apache/commons/compress/archivers/tar/TarUtils.java  | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/469cf4d8/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
index d132d9d..ec5b767 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -290,12 +290,8 @@ public class TarUtils {
                                    final ZipEncoding encoding)
         throws IOException {
 
-        int len = length;
-        for (; len > 0; len--) {
-            if (buffer[offset + len - 1] != 0) {
-                break;
-            }
-        }
+        int len = 0;
+        for (int i = offset; len < length && buffer[i] != 0; i++, len++);
         if (len > 0) {
             final byte[] b = new byte[len];
             System.arraycopy(buffer, offset, b, 0, len);