1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Merge pull request #2861 from jtojanen/fixes

Fix iconv_ctx and iconv_tmp leaks in backend.c
This commit is contained in:
Jens Steube 2021-07-04 09:52:29 +02:00 committed by GitHub
commit d99b4cf46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
}