1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Fix iconv_ctx and iconv_tmp leaks in backend.c

This commit is contained in:
Jukka Ojanen 2021-07-03 12:51:37 +03:00
parent c32242980f
commit 5f109b5862

View File

@ -4514,7 +4514,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
iconv_t iconv_ctx = NULL;
char *iconv_tmp = NULL;
char iconv_tmp[HCBUFSIZ_TINY] = { 0 };
if (strcmp (user_options->encoding_from, user_options->encoding_to) != 0)
{
@ -4523,8 +4523,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
iconv_ctx = iconv_open (user_options->encoding_to, user_options->encoding_from);
if (iconv_ctx == (iconv_t) -1) return -1;
iconv_tmp = (char *) hcmalloc (HCBUFSIZ_TINY);
}
// find higest password length, this is for optimization stuff
@ -5160,6 +5158,11 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
device_param->speed_only_finish = true;
}
if (iconv_enabled == true)
{
iconv_close (iconv_ctx);
}
return 0;
}