From: Joerg Sonnenberger Date: Fri, 28 Apr 2017 21:32:32 +0000 (+0200) Subject: Short cut zero size to avoid notnull attribute for mmemove in glibc. X-Git-Tag: v3.3.2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e660621b4b00eaf4ef7a508aedf52c5a421bd2e;p=thirdparty%2Flibarchive.git Short cut zero size to avoid notnull attribute for mmemove in glibc. Reported-By: OSS-Fuzz issue 497 --- diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 592ead2bd..ca39c069a 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -200,6 +200,8 @@ static int archive_string_append_unicode(struct archive_string *, static struct archive_string * archive_string_append(struct archive_string *as, const char *p, size_t s) { + if (s == 0) + return (as); if (archive_string_ensure(as, as->length + s + 1) == NULL) return (NULL); memmove(as->s + as->length, p, s);