Skip to content

Commit

Permalink
Avoid usage of uninit members of ctx
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
lucic71 committed Apr 28, 2024
1 parent 06049b7 commit 0ed9beb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/zip2john.c
Expand Up @@ -995,6 +995,8 @@ static void scan_central_index(const char *fname)
uint64_t cd_size, cd_start_offset;
zip_context ctx;

memset(&ctx, 0, sizeof(zip_context));

if (!(fp = fopen(fname, "rb"))) {
fprintf(stderr, "! %s : %s\n", fname, strerror(errno));
return;
Expand Down

0 comments on commit 0ed9beb

Please sign in to comment.