[PATCH 1/1] archival: get_header_tar string termination fix

Alexey Fomenko ext-alexey.fomenko at nokia.com
Wed Oct 19 08:11:16 UTC 2011


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

Signed-off-by: Alexey Fomenko <ext-alexey.fomenko at 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



More information about the busybox mailing list