From 6cf553410be09cfb7cefd6d2dfa6547d4faae638 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Wed, 11 Aug 2021 14:06:48 +0300 Subject: [PATCH] Avoid (possible) undefined behaviour in hc_fclose(), and don't assume plain file --- src/filehandling.c | 2 +- src/potfile.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/filehandling.c b/src/filehandling.c index 9edd1cb35..a858a82bf 100644 --- a/src/filehandling.c +++ b/src/filehandling.c @@ -596,7 +596,7 @@ void hc_fclose (HCFILE *fp) unzClose (fp->ufp); } - else + else if (fp->pfp) { fclose (fp->pfp); } diff --git a/src/potfile.c b/src/potfile.c index 978247afa..fe8448066 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -211,8 +211,6 @@ void potfile_read_close (hashcat_ctx_t *hashcat_ctx) if (hashconfig->potfile_disable == true) return; - if (potfile_ctx->fp.pfp == NULL) return; - hc_fclose (&potfile_ctx->fp); }