[PATCH] fix getOctal base256 calculation in get_header_tar.c

Etienne Le Sueur elesueur at vmware.com
Wed Jun 6 17:04:50 UTC 2012


Hi,

I found an error in the base256 calculation in get_header_tar.c. The first
byte was being added twice, this patch is a simple one-liner fix.

Cheers,
Etienne Le Sueur


Signed-off-by:
---
   archival/libarchive/get_header_tar.c |    2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/archival/libarchive/get_header_tar.c
b/archival/libarchive/get_header_tar.c
index 80a7091..7b0bebb 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -60,7 +60,7 @@ static unsigned long long getOctal(char *str, int len)
          /* std: "Each numeric field is terminated by one or more
           *<space>  or NUL characters". We must support ' '! */
          if (*end != '\0'&&  *end != ' ') {
-               int8_t first = str[0];
+               int8_t first = *str++;
                  if (!(first&  0x80))
                          bb_error_msg_and_die("corrupted octal value in tar header");
                  /*



More information about the busybox mailing list