diff --git a/docs/changes.txt b/docs/changes.txt index 133f44089..10ab89d59 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -44,6 +44,7 @@ - Added docs/team.txt - Replaced some uint macros with enums types - Improved default hashcat.hcstat +- Improved NSEC3 hashes parsing error detection * changes v3.00 -> v3.10: diff --git a/src/interface.c b/src/interface.c index 38743f0da..b5cd1a3b1 100644 --- a/src/interface.c +++ b/src/interface.c @@ -6851,13 +6851,17 @@ int nsec3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUS memcpy (salt_buf_pc_ptr, domainbuf_pos, domainbuf_len); - u8 *len_ptr = NULL; + if (salt_buf_pc_ptr[0] != '.') return (PARSER_SALT_VALUE); - for (u32 i = 0; i < domainbuf_len; i++) + u8 *len_ptr = salt_buf_pc_ptr; + + *len_ptr = 0; + + for (u32 i = 1; i < domainbuf_len; i++) { if (salt_buf_pc_ptr[i] == '.') { - len_ptr = &salt_buf_pc_ptr[i]; + len_ptr = salt_buf_pc_ptr + i; *len_ptr = 0; }