From: Graham Percival Date: Mon, 7 Sep 2015 21:31:49 +0000 (-0700) Subject: Check for strdup() allocation failure X-Git-Tag: v3.1.900a~66^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F601%2Fhead;p=thirdparty%2Flibarchive.git Check for strdup() allocation failure Sponsored by: Tarsnap Backup Inc. --- diff --git a/libarchive/archive_entry_xattr.c b/libarchive/archive_entry_xattr.c index a3efe7ca8..05eb90f1a 100644 --- a/libarchive/archive_entry_xattr.c +++ b/libarchive/archive_entry_xattr.c @@ -98,7 +98,10 @@ archive_entry_xattr_add_entry(struct archive_entry *entry, /* XXX Error XXX */ return; - xp->name = strdup(name); + if ((xp->name = strdup(name)) == NULL) + /* XXX Error XXX */ + return; + if ((xp->value = malloc(size)) != NULL) { memcpy(xp->value, value, size); xp->size = size;