From: Tim Kientzle Date: Thu, 17 Nov 2011 05:38:07 +0000 (-0500) Subject: Check the position before dereferencing the pointer. X-Git-Tag: v3.0.4~2^2~169^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4ba4e9e080aa97726b0bd088e989b6cd6bbc9bc;p=thirdparty%2Flibarchive.git Check the position before dereferencing the pointer. This avoids dereferencing one byte past the end of a string. SVN-Revision: 3799 --- 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++; }