]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix unchecked calloc result in tree_open
authorTim Kientzle <kientzle@acm.org>
Sat, 16 May 2026 17:03:11 +0000 (10:03 -0700)
committerTim Kientzle <kientzle@acm.org>
Sat, 16 May 2026 17:03:11 +0000 (10:03 -0700)
If calloc fails, t would be NULL and immediately dereferenced.
Return NULL on allocation failure.

libarchive/archive_read_disk_windows.c

index 77687149febc379b346e2e83d7c06c83cf490291..c6a2aa65036bea4971943f20c0f6f357a9076336 100644 (file)
@@ -1708,6 +1708,8 @@ tree_open(const wchar_t *path, int symlink_mode, int restore_time)
        struct tree *t;
 
        t = calloc(1, sizeof(*t));
+       if (t == NULL)
+               return (NULL);
        archive_string_init(&(t->full_path));
        archive_string_init(&t->path);
        if (archive_wstring_ensure(&t->path, 15) == NULL) {