mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-16 04:49:24 +00:00
Merge pull request #1082 from philsmd/master
we always need to check for NULL after strchr ()
This commit is contained in:
commit
b682091155
@ -7448,6 +7448,8 @@ int des_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED
|
|||||||
|
|
||||||
u8 *salt_pos = (u8 *) strchr ((const char *) digest_pos, ':');
|
u8 *salt_pos = (u8 *) strchr ((const char *) digest_pos, ':');
|
||||||
|
|
||||||
|
if (salt_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
|
|
||||||
if (input_buf[16] != hashconfig->separator) return (PARSER_SEPARATOR_UNMATCHED);
|
if (input_buf[16] != hashconfig->separator) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
|
|
||||||
u32 salt_len = salt_pos - digest_pos;
|
u32 salt_len = salt_pos - digest_pos;
|
||||||
@ -8022,6 +8024,8 @@ int juniper_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
|
|||||||
|
|
||||||
u8 *hash_pos = (u8 *) strchr ((const char *) salt_pos, '$'); // or simply salt_pos + 8
|
u8 *hash_pos = (u8 *) strchr ((const char *) salt_pos, '$'); // or simply salt_pos + 8
|
||||||
|
|
||||||
|
if (hash_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
|
|
||||||
salt->salt_len = hash_pos - salt_pos; // should be 8
|
salt->salt_len = hash_pos - salt_pos; // should be 8
|
||||||
|
|
||||||
memcpy ((u8 *) salt->salt_buf, salt_pos, salt->salt_len);
|
memcpy ((u8 *) salt->salt_buf, salt_pos, salt->salt_len);
|
||||||
@ -10544,6 +10548,8 @@ int postgresql_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf,
|
|||||||
|
|
||||||
u8 *hash_pos = (u8 *) strchr ((const char *) salt_pos, '*');
|
u8 *hash_pos = (u8 *) strchr ((const char *) salt_pos, '*');
|
||||||
|
|
||||||
|
if (hash_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
|
|
||||||
hash_pos++;
|
hash_pos++;
|
||||||
|
|
||||||
u32 hash_len = input_len - (hash_pos - input_buf);
|
u32 hash_len = input_len - (hash_pos - input_buf);
|
||||||
@ -12670,6 +12676,8 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
|
|||||||
{
|
{
|
||||||
u8 *keyfile_len_pos = (u8 *) strchr ((const char *) keyfile_inline_pos, '*');
|
u8 *keyfile_len_pos = (u8 *) strchr ((const char *) keyfile_inline_pos, '*');
|
||||||
|
|
||||||
|
if (keyfile_len_pos == NULL) return (PARSER_SALT_LENGTH);
|
||||||
|
|
||||||
keyfile_len_pos++;
|
keyfile_len_pos++;
|
||||||
|
|
||||||
int keyfile_len = atoi ((const char *) keyfile_len_pos);
|
int keyfile_len = atoi ((const char *) keyfile_len_pos);
|
||||||
|
Loading…
Reference in New Issue
Block a user