increase HCBUFSIZ_LARGE and truncate too large strings when copied to old_buf in events

pull/1453/head
philsmd 7 years ago
parent c8819e6e8b
commit ef6b20cc30
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF

@ -13,6 +13,12 @@
- Fixed a hash parsing problem when using --show/--left together with hashes with long salts that require pure kernels
- Fixed the output of --show if $HEX[] passwords are present within the potfile
##
## Technical
##
- Changed the way large strings are handled/truncated within the event buffer if they are too large to fit
* changes v4.0.0 -> v4.0.1:
##

@ -104,7 +104,7 @@ but this is nededed for VS compiler which doesn't have inline keyword but has __
#define SALT_MAX_OLD 51
#define HCBUFSIZ_TINY 0x1000
#define HCBUFSIZ_LARGE 0x50000
#define HCBUFSIZ_LARGE 0xb0000
#define CPT_CACHE 0x20000
#define PARAMCNT 64

@ -45,12 +45,20 @@ void event_call (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, cons
event_ctx->old_len[i] = event_ctx->old_len[i - 1];
}
u32 copy_len = 0;
if (buf)
{
memcpy (event_ctx->old_buf[0], buf, len);
// truncate the whole buffer if needed (such that it fits into the old_buf):
const u32 max_buf_len = sizeof (event_ctx->old_buf[0]);
copy_len = MIN (len, max_buf_len - 1);
memcpy (event_ctx->old_buf[0], buf, copy_len);
}
event_ctx->old_len[0] = len;
event_ctx->old_len[0] = copy_len;
}
}

Loading…
Cancel
Save