1
mirror of https://github.com/hashcat/hashcat synced 2024-12-01 20:18:12 +01:00

Merge pull request #1082 from philsmd/master

we always need to check for NULL after strchr ()
This commit is contained in:
Jens Steube 2017-02-14 17:55:37 +01:00 committed by GitHub
commit b682091155

View File

@ -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, ':');
if (salt_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
if (input_buf[16] != hashconfig->separator) return (PARSER_SEPARATOR_UNMATCHED);
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
if (hash_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
salt->salt_len = hash_pos - salt_pos; // should be 8
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, '*');
if (hash_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
hash_pos++;
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, '*');
if (keyfile_len_pos == NULL) return (PARSER_SALT_LENGTH);
keyfile_len_pos++;
int keyfile_len = atoi ((const char *) keyfile_len_pos);