summaryrefslogtreecommitdiff
path: root/libarchive/archive_string.c
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2017-04-28 23:32:32 +0200
committerJoerg Sonnenberger <joerg@bec.de>2017-04-28 23:32:32 +0200
commit1e660621b4b00eaf4ef7a508aedf52c5a421bd2e (patch)
treec03c1705fdbde2396653dac6db679c51ba2b7511 /libarchive/archive_string.c
parentb025f169ec7e301bc1ceeb66d6ad81369067484b (diff)
downloadlibarchive-1e660621b4b00eaf4ef7a508aedf52c5a421bd2e.tar.gz
Short cut zero size to avoid notnull attribute for mmemove in glibc.
Reported-By: OSS-Fuzz issue 497
Diffstat (limited to 'libarchive/archive_string.c')
-rw-r--r--libarchive/archive_string.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c
index 592ead2b..ca39c069 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);