Fix segfault in --hash-info by avoid huge stack buffer allocation

pull/2861/head
Jens Steube 3 years ago
parent 56c2243dfb
commit 701ad7c441

@ -20,6 +20,6 @@ int outfile_init (hashcat_ctx_t *hashcat_ctx);
void outfile_destroy (hashcat_ctx_t *hashcat_ctx);
int outfile_write_open (hashcat_ctx_t *hashcat_ctx);
void outfile_write_close (hashcat_ctx_t *hashcat_ctx);
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, const bool print_eol, char tmp_buf[HCBUFSIZ_LARGE]);
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, const bool print_eol, char *tmp_buf);
#endif // _OUTFILE_H

@ -550,7 +550,7 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx)
hc_fclose (&outfile_ctx->fp);
}
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, const bool print_eol, char tmp_buf[HCBUFSIZ_LARGE])
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, const bool print_eol, char *tmp_buf)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const user_options_t *user_options = hashcat_ctx->user_options;

@ -636,7 +636,7 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_t *user_options)
if (need_hexify ((const u8 *) hashconfig->st_pass, strlen (hashconfig->st_pass), user_options->separator, false))
{
char tmp_buf[HCBUFSIZ_LARGE] = { 0 };
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
int tmp_len = 0;
@ -654,6 +654,8 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_t *user_options)
tmp_buf[tmp_len++] = 0;
event_log_info (hashcat_ctx, " Example.Pass........: %s", tmp_buf);
hcfree (tmp_buf);
}
else
{

Loading…
Cancel
Save