From 1e660621b4b00eaf4ef7a508aedf52c5a421bd2e Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Fri, 28 Apr 2017 23:32:32 +0200 Subject: [PATCH] Short cut zero size to avoid notnull attribute for mmemove in glibc. Reported-By: OSS-Fuzz issue 497 --- libarchive/archive_string.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.2