From df6ba947752d58a519afcb9f5846b9e9f47c892a Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Mon, 7 Sep 2015 14:31:49 -0700 Subject: [PATCH] Check for strdup() allocation failure Sponsored by: Tarsnap Backup Inc. --- libarchive/archive_entry_xattr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.47.2