Merge pull request #601 from Tarsnap/strdup-allocation-failure-check

Check for strdup() allocation failure
This commit is contained in:
Tim Kientzle 2015-09-09 21:20:28 -07:00
commit 16dbeeb552

View File

@ -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;