1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Hash Parser: Improved error detection of invalid hex characters where hex character are expected

This commit is contained in:
jsteube 2016-12-23 14:57:46 +01:00
parent 72af615e8b
commit fa5b5d298d
5 changed files with 336 additions and 1 deletions

View File

@ -35,6 +35,7 @@
- Threads: Replaced all calls to strerror() with %m printf() GNU extension to ensure thread safety
- Threads: Replaced all calls to ctime() with ctime_r() to ensure thread safety
- OpenCL Runtime: Updated AMDGPU-Pro driver version check, do warn if version 16.50 is detected which is known to be broken
- Hash Parser: Improved error detection of invalid hex characters where hex character are expected
* changes v3.10 -> v3.20:

View File

@ -11,7 +11,8 @@
bool need_hexify (const u8 *buf, const int len, const char separator, bool always_ascii);
void exec_hexify (const u8 *buf, const int len, u8 *out);
bool is_valid_hex_char (const u8 c);
bool is_valid_hex_string (const u8 *s, const int len);
bool is_valid_hex_char (const u8 c);
u8 hex_convert (const u8 c);

View File

@ -434,6 +434,8 @@ typedef enum parser_rc
PARSER_VC_FILE_SIZE = -16,
PARSER_SIP_AUTH_DIRECTIVE = -17,
PARSER_HASH_FILE = -18,
PARSER_HASH_ENCODING = -19,
PARSER_SALT_ENCODING = -20,
PARSER_UNKNOWN_ERROR = -255
} parser_rc_t;

View File

@ -140,6 +140,18 @@ void exec_hexify (const u8 *buf, const int len, u8 *out)
out[max_len * 2] = 0;
}
bool is_valid_hex_string (const u8 *s, const int len)
{
for (int i = 0; i < len; i++)
{
const u8 c = s[i];
if (is_valid_hex_char (c) == false) return false;
}
return true;
}
bool is_valid_hex_char (const u8 c)
{
if ((c >= '0') && (c <= '9')) return true;

File diff suppressed because it is too large Load Diff