From c4ba4e9e080aa97726b0bd088e989b6cd6bbc9bc Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Thu, 17 Nov 2011 00:38:07 -0500 Subject: [PATCH] Check the position before dereferencing the pointer. This avoids dereferencing one byte past the end of a string. SVN-Revision: 3799 --- libarchive/archive_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 4e57d62e1..95bed6eda 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -152,7 +152,7 @@ __archive_strncat(struct archive_string *as, const void *_p, size_t n) /* Like strlen(p), except won't examine positions beyond p[n]. */ s = 0; pp = p; - while (*pp && s < n) { + while (s < n && *pp) { pp++; s++; } -- 2.47.3