diff options
author | Li kunyu <kunyu@nfschina.com> | 2023-02-14 12:34:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-13 20:34:35 -0800 |
commit | 4042c50425afe29cdfb56759a09d2075e0b4dac1 (patch) | |
tree | 1d15fb2ccffbcdc1847fb7d352a22e3c4ae374b9 /libarchive | |
parent | 90799596b2ef2f847d669b610919e8d51a382503 (diff) | |
download | libarchive-4042c50425afe29cdfb56759a09d2075e0b4dac1.tar.gz |
archive_read_data_into_fd: Increase pointer assignment check (#1843)
Diffstat (limited to 'libarchive')
-rw-r--r-- | libarchive/archive_read_data_into_fd.c | 7 |
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) { |