]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
archive_read_data_into_fd: Increase pointer assignment check (#1843)
authorLi kunyu <kunyu@nfschina.com>
Tue, 14 Feb 2023 04:34:35 +0000 (12:34 +0800)
committerGitHub <noreply@github.com>
Tue, 14 Feb 2023 04:34:35 +0000 (20:34 -0800)
libarchive/archive_read_data_into_fd.c

index b4398f1ecce879fa2408a18da3283d043b0a6512..f16ca5c82b1504da631929be21428c6b8f2fe346 100644 (file)
@@ -95,8 +95,13 @@ archive_read_data_into_fd(struct archive *a, int fd)
            "archive_read_data_into_fd");
 
        can_lseek = (fstat(fd, &st) == 0) && S_ISREG(st.st_mode);
-       if (!can_lseek)
+       if (!can_lseek) {
                nulls = calloc(1, nulls_size);
+               if (!nulls) {
+                       r = ARCHIVE_FATAL;
+                       goto cleanup;
+               }
+       }
 
        while ((r = archive_read_data_block(a, &buff, &size, &target_offset)) ==
            ARCHIVE_OK) {