summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi kunyu <kunyu@nfschina.com>2023-02-14 12:34:35 +0800
committerGitHub <noreply@github.com>2023-02-13 20:34:35 -0800
commit4042c50425afe29cdfb56759a09d2075e0b4dac1 (patch)
tree1d15fb2ccffbcdc1847fb7d352a22e3c4ae374b9
parent90799596b2ef2f847d669b610919e8d51a382503 (diff)
downloadlibarchive-4042c50425afe29cdfb56759a09d2075e0b4dac1.tar.gz
archive_read_data_into_fd: Increase pointer assignment check (#1843)
-rw-r--r--libarchive/archive_read_data_into_fd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libarchive/archive_read_data_into_fd.c b/libarchive/archive_read_data_into_fd.c
index b4398f1e..f16ca5c8 100644
--- a/libarchive/archive_read_data_into_fd.c
+++ b/libarchive/archive_read_data_into_fd.c
@@ -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) {