From: Li kunyu Date: Tue, 14 Feb 2023 04:34:35 +0000 (+0800) Subject: archive_read_data_into_fd: Increase pointer assignment check (#1843) X-Git-Tag: v3.7.0~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4042c50425afe29cdfb56759a09d2075e0b4dac1;p=thirdparty%2Flibarchive.git archive_read_data_into_fd: Increase pointer assignment check (#1843) --- diff --git a/libarchive/archive_read_data_into_fd.c b/libarchive/archive_read_data_into_fd.c index b4398f1ec..f16ca5c82 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) {