From 59f1bbeed60ba9ca066ded8021d7379c322103b5 Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Sun, 28 Apr 2024 17:19:50 +0300 Subject: [PATCH] zip2john: avoid usage of uninit members of ctx `if (ctx.archive.zip64) {` is used uninitialized if `ctx.archive.zip64 = zip64;` is not executed. Memset'ing the whole struct at the beginning of the function avoids this problem. --- src/zip2john.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zip2john.c b/src/zip2john.c index 1b0414657e8..7c54d4b131d 100644 --- a/src/zip2john.c +++ b/src/zip2john.c @@ -993,7 +993,7 @@ static void scan_central_index(const char *fname) uint32_t this_disk, cd_start_disk; uint64_t num_records, num_records_total; uint64_t cd_size, cd_start_offset; - zip_context ctx; + zip_context ctx = {}; if (!(fp = fopen(fname, "rb"))) { fprintf(stderr, "! %s : %s\n", fname, strerror(errno));