[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 1/1] archival: get_header_tar string termination fix
From:       Alexey Fomenko <ext-alexey.fomenko () nokia ! com>
Date:       2011-10-19 8:11:16
Message-ID: 1319011876-428-2-git-send-email-ext-alexey.fomenko () nokia ! com
[Download RAW message or body]

Fix getOctal() argument string termination to be withing array bounds.

Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com>
---
 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 79caff5..924547e 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -55,7 +55,7 @@ static unsigned long long getOctal(char *str, int len)
 	/* NB: leading spaces are allowed. Using strtoull to handle that.
 	 * The downside is that we accept e.g. "-123" too :(
 	 */
-	str[len] = '\0';
+	str[len-1] = '\0';
 	v = strtoull(str, &end, 8);
 	/* std: "Each numeric field is terminated by one or more
 	 * <space> or NUL characters". We must support ' '! */
-- 
1.7.2.5

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic