aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_read_support_format_ar.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2016-12-15 15:35:53 +0000
committerMartin Matuska <mm@FreeBSD.org>2016-12-15 15:35:53 +0000
commit8e86d3576b5d090c0d44d5fd2c4829fce64e3b34 (patch)
tree4d5481886c664d296875d9d996ccd3f5ae8090cb /libarchive/archive_read_support_format_ar.c
parentf428c3b114eca361b2c069d987e95553368cd827 (diff)
downloadsrc-8e86d3576b5d090c0d44d5fd2c4829fce64e3b34.tar.gz
src-8e86d3576b5d090c0d44d5fd2c4829fce64e3b34.zip
Update vendor/libarchive to git to 30528ed7a9f479f1c363ee8cfa1c5eb4c7d9be10
Vendor bugfixes: PR 826: OpenSSL 1.1 support PR 830, 831, 833: Spelling fixes OSS-Fuzz 227, 230, 239: Fix possible memory leak in archive_read_free() OSS-Fuzz 237: Fix heap buffer overflow when reading invalid ar archives
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=310115
Diffstat (limited to 'libarchive/archive_read_support_format_ar.c')
-rw-r--r--libarchive/archive_read_support_format_ar.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libarchive/archive_read_support_format_ar.c b/libarchive/archive_read_support_format_ar.c
index c766cbaba7a8..b6b9fc3c6dcd 100644
--- a/libarchive/archive_read_support_format_ar.c
+++ b/libarchive/archive_read_support_format_ar.c
@@ -104,13 +104,12 @@ archive_read_support_format_ar(struct archive *_a)
archive_check_magic(_a, ARCHIVE_READ_MAGIC,
ARCHIVE_STATE_NEW, "archive_read_support_format_ar");
- ar = (struct ar *)malloc(sizeof(*ar));
+ ar = (struct ar *)calloc(1, sizeof(*ar));
if (ar == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate ar data");
return (ARCHIVE_FATAL);
}
- memset(ar, 0, sizeof(*ar));
ar->strtab = NULL;
r = __archive_read_register_format(a,
@@ -316,7 +315,7 @@ _ar_read_header(struct archive_read *a, struct archive_entry *entry,
* If we can't look up the real name, warn and return
* the entry with the wrong name.
*/
- if (ar->strtab == NULL || number > ar->strtab_size) {
+ if (ar->strtab == NULL || number >= ar->strtab_size) {
archive_set_error(&a->archive, EINVAL,
"Can't find long filename for GNU/SVR4 archive entry");
archive_entry_copy_pathname(entry, filename);