1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Fixed memory leaks in tuning_db_init in tuningdb.c

This commit is contained in:
Gabriele Gristina 2024-10-27 00:45:44 +02:00
parent 6716447dfc
commit 356ad9f927
2 changed files with 17 additions and 2 deletions

View File

@ -95,6 +95,7 @@
- Fixed keys extraction in luks2hashcat - now extracts all active keys
- Fixed maximum password length in module/test_module of hash-mode 2400
- Fixed maximum password length in module/test_module of hash-mode 2410
- Fixed memory leaks in tuning_db_init in tuningdb.c
- Fixed minimum password length in module of hash-mode 28200
- Fixed minimum password length in module of hash-mode 29800
- Fixed out-of-boundary read when a fast hash defines a kernel_loops_min value higher than the amplifiers provided by the user

View File

@ -72,6 +72,8 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
char **tuning_db_files = scan_directory (tuning_db_folder);
hcfree (tuning_db_folder);
for (int i = 0; tuning_db_files[i] != NULL; i++)
{
char *tuning_db_file = tuning_db_files[i];
@ -80,9 +82,19 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
const size_t dblen = strlen (tuning_db_file);
if (dblen < suflen) continue; // make sure to not do any out-of-boundary reads
if (dblen < suflen)
{
hcfree (tuning_db_file);
if (memcmp (tuning_db_file + dblen - suflen, TUNING_DB_SUFFIX, suflen) != 0) continue;
continue; // make sure to not do any out-of-boundary reads
}
if (memcmp (tuning_db_file + dblen - suflen, TUNING_DB_SUFFIX, suflen) != 0)
{
hcfree (tuning_db_file);
continue;
}
HCFILE fp;
@ -90,6 +102,8 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
{
event_log_error (hashcat_ctx, "%s: %s", tuning_db_file, strerror (errno));
for (int j = 0; tuning_db_files[j] != NULL; j++) hcfree (tuning_db_files[j]);
return -1;
}