1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 14:48:12 +00:00

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

This commit is contained in:
Jens Steube 2021-06-30 21:01:55 +02:00
parent 56c2243dfb
commit 701ad7c441
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

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

View File

@ -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
{