mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-24 23:48:39 +00:00
always check the input for NULL before the strtok_r () calls
This commit is contained in:
parent
f9bbd42b4a
commit
f535eb2bd0
@ -63,6 +63,8 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
char *devices = hcstrdup (user_options->cpu_affinity);
|
char *devices = hcstrdup (user_options->cpu_affinity);
|
||||||
|
|
||||||
|
if (devices == NULL) return -1;
|
||||||
|
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
|
|
||||||
char *next = strtok_r (devices, ",", &saveptr);
|
char *next = strtok_r (devices, ",", &saveptr);
|
||||||
@ -88,7 +90,7 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
hcfree (devices);
|
hcfree (devices);
|
||||||
|
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (_WIN)
|
#if defined (_WIN)
|
||||||
|
@ -99,7 +99,7 @@ int cpu_crc32 (hashcat_ctx_t *hashcat_ctx, const char *filename, u8 keytab[64])
|
|||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno));
|
event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno));
|
||||||
|
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_KEY_SIZE (1024 * 1024)
|
#define MAX_KEY_SIZE (1024 * 1024)
|
||||||
|
@ -5112,10 +5112,10 @@ int ikepsk_md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
|
|||||||
|
|
||||||
size_t in_len[9] = { 0 };
|
size_t in_len[9] = { 0 };
|
||||||
|
|
||||||
char *saveptr;
|
|
||||||
|
|
||||||
if (input_buf == NULL) return (PARSER_HASH_VALUE);
|
if (input_buf == NULL) return (PARSER_HASH_VALUE);
|
||||||
|
|
||||||
|
char *saveptr;
|
||||||
|
|
||||||
in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr);
|
in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr);
|
||||||
|
|
||||||
if (in_off[0] == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
if (in_off[0] == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
@ -5200,10 +5200,10 @@ int ikepsk_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB
|
|||||||
|
|
||||||
size_t in_len[9] = { 0 };
|
size_t in_len[9] = { 0 };
|
||||||
|
|
||||||
char *saveptr;
|
|
||||||
|
|
||||||
if (input_buf == NULL) return (PARSER_HASH_VALUE);
|
if (input_buf == NULL) return (PARSER_HASH_VALUE);
|
||||||
|
|
||||||
|
char *saveptr;
|
||||||
|
|
||||||
in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr);
|
in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr);
|
||||||
|
|
||||||
if (in_off[0] == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
if (in_off[0] == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
@ -22511,6 +22511,8 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
char *keyfiles = hcstrdup (tcvc_keyfiles);
|
char *keyfiles = hcstrdup (tcvc_keyfiles);
|
||||||
|
|
||||||
|
if (keyfiles == NULL) return -1;
|
||||||
|
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
|
|
||||||
char *keyfile = strtok_r (keyfiles, ",", &saveptr);
|
char *keyfile = strtok_r (keyfiles, ",", &saveptr);
|
||||||
|
@ -180,6 +180,8 @@ static int setup_opencl_platforms_filter (hashcat_ctx_t *hashcat_ctx, const char
|
|||||||
{
|
{
|
||||||
char *platforms = hcstrdup (opencl_platforms);
|
char *platforms = hcstrdup (opencl_platforms);
|
||||||
|
|
||||||
|
if (platforms == NULL) return -1;
|
||||||
|
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
|
|
||||||
char *next = strtok_r (platforms, ",", &saveptr);
|
char *next = strtok_r (platforms, ",", &saveptr);
|
||||||
@ -221,6 +223,8 @@ static int setup_devices_filter (hashcat_ctx_t *hashcat_ctx, const char *opencl_
|
|||||||
{
|
{
|
||||||
char *devices = hcstrdup (opencl_devices);
|
char *devices = hcstrdup (opencl_devices);
|
||||||
|
|
||||||
|
if (devices == NULL) return -1;
|
||||||
|
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
|
|
||||||
char *next = strtok_r (devices, ",", &saveptr);
|
char *next = strtok_r (devices, ",", &saveptr);
|
||||||
@ -262,6 +266,8 @@ static int setup_device_types_filter (hashcat_ctx_t *hashcat_ctx, const char *op
|
|||||||
{
|
{
|
||||||
char *device_types = hcstrdup (opencl_device_types);
|
char *device_types = hcstrdup (opencl_device_types);
|
||||||
|
|
||||||
|
if (device_types == NULL) return -1;
|
||||||
|
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
|
|
||||||
char *next = strtok_r (device_types, ",", &saveptr);
|
char *next = strtok_r (device_types, ",", &saveptr);
|
||||||
|
@ -119,6 +119,8 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
int token_cnt = 0;
|
int token_cnt = 0;
|
||||||
|
|
||||||
|
if (line_buf == NULL) continue;
|
||||||
|
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
|
|
||||||
char *next = strtok_r (line_buf, "\t ", &saveptr);
|
char *next = strtok_r (line_buf, "\t ", &saveptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user