]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Check for strdup() allocation failure 601/head
authorGraham Percival <gperciva@tarsnap.com>
Mon, 7 Sep 2015 21:31:49 +0000 (14:31 -0700)
committerGraham Percival <gperciva@tarsnap.com>
Mon, 7 Sep 2015 21:31:49 +0000 (14:31 -0700)
Sponsored by: Tarsnap Backup Inc.

libarchive/archive_entry_xattr.c

index a3efe7ca8d9f2a71ee83bf279a6890feef0b8192..05eb90f1afd1ff1188c9604007c4de5da6206b60 100644 (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;