]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
archive_read_disk_posix: fail if unable to alocate memory in tree_push()
authorMartin Matuska <martin@matuska.de>
Thu, 8 Dec 2022 15:05:53 +0000 (16:05 +0100)
committerMartin Matuska <martin@matuska.de>
Thu, 8 Dec 2022 15:05:53 +0000 (16:05 +0100)
Reported by: GitHub CodeQL
Code Scanning Alert: 189

libarchive/archive_read_disk_posix.c

index a96008db7b7982bd106f63f8c5eab1d23d3b5de0..5a94ec5d4399fa6848c5161b73806b55000a1075 100644 (file)
@@ -2102,6 +2102,8 @@ tree_push(struct tree *t, const char *path, int filesystem_id,
        struct tree_entry *te;
 
        te = calloc(1, sizeof(*te));
+       if (te == NULL)
+               __archive_errx(1, "Out of memory");
        te->next = t->stack;
        te->parent = t->current;
        if (te->parent)