From 6915bfad8ba6c0f35b1bd19f5b88bc01e36ef883 Mon Sep 17 00:00:00 2001 From: philsmd Date: Tue, 14 Feb 2017 17:32:39 +0100 Subject: [PATCH] keyfiles: for VeraCrypt/TrueCrypt keyfiles we need to free the memory in case of errors --- docs/changes.txt | 1 + src/interface.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 7192d9285..060174e17 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -84,6 +84,7 @@ - File Locking: Improved error detection on file locks - Hash Parsing: Added additional bound checks for the SIP digest authentication (MD5) parser (-m 11400) - Hash Parsing: Make sure that all files are correctly closed whenever a hash file parsing error occurs +- Keyfile handling: Make sure that the memory is cleanly freed whenever a VeraCrypt/TrueCrypt keyfile fails to load - Sessions: Move out handling of multiple instance from restore file into separate pidfile - Threads: Restored strerror as %m is unsupported by the BSDs - Wordlists: Fixed memory leak in case access a file in a wordlist folder fails diff --git a/src/interface.c b/src/interface.c index b09cb2e20..470dc02f9 100644 --- a/src/interface.c +++ b/src/interface.c @@ -22506,7 +22506,12 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx) { const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) keyfile_buf); - if (rc_crc32 == -1) return -1; + if (rc_crc32 == -1) + { + free (keyfiles); + + return -1; + } } while ((keyfile = strtok_r (NULL, ",", &saveptr)) != NULL);