1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-15 12:29:35 +00:00

Merge pull request #1092 from philsmd/master

fix our usage of strtok_r (), it was not 100% correct
This commit is contained in:
Jens Steube 2017-02-14 20:12:18 +01:00 committed by GitHub
commit f9bbd42b4a
4 changed files with 19 additions and 8 deletions

View File

@ -63,7 +63,7 @@ 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);
char *saveptr = NULL; char *saveptr;
char *next = strtok_r (devices, ",", &saveptr); char *next = strtok_r (devices, ",", &saveptr);

View File

@ -5112,7 +5112,9 @@ 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 = NULL; char *saveptr;
if (input_buf == NULL) return (PARSER_HASH_VALUE);
in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr); in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr);
@ -5198,7 +5200,9 @@ 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 = NULL; char *saveptr;
if (input_buf == NULL) return (PARSER_HASH_VALUE);
in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr); in_off[0] = (u8 *) strtok_r ((char *) input_buf, ":", &saveptr);
@ -22507,10 +22511,17 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
char *keyfiles = hcstrdup (tcvc_keyfiles); char *keyfiles = hcstrdup (tcvc_keyfiles);
char *saveptr = NULL; char *saveptr;
char *keyfile = strtok_r (keyfiles, ",", &saveptr); char *keyfile = strtok_r (keyfiles, ",", &saveptr);
if (keyfile == NULL)
{
free (keyfiles);
return -1;
}
do do
{ {
const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) keyfile_buf); const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) keyfile_buf);

View File

@ -180,7 +180,7 @@ static int setup_opencl_platforms_filter (hashcat_ctx_t *hashcat_ctx, const char
{ {
char *platforms = hcstrdup (opencl_platforms); char *platforms = hcstrdup (opencl_platforms);
char *saveptr = NULL; char *saveptr;
char *next = strtok_r (platforms, ",", &saveptr); char *next = strtok_r (platforms, ",", &saveptr);
@ -221,7 +221,7 @@ static int setup_devices_filter (hashcat_ctx_t *hashcat_ctx, const char *opencl_
{ {
char *devices = hcstrdup (opencl_devices); char *devices = hcstrdup (opencl_devices);
char *saveptr = NULL; char *saveptr;
char *next = strtok_r (devices, ",", &saveptr); char *next = strtok_r (devices, ",", &saveptr);
@ -262,7 +262,7 @@ 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);
char *saveptr = NULL; char *saveptr;
char *next = strtok_r (device_types, ",", &saveptr); char *next = strtok_r (device_types, ",", &saveptr);

View File

@ -119,7 +119,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
int token_cnt = 0; int token_cnt = 0;
char *saveptr = NULL; char *saveptr;
char *next = strtok_r (line_buf, "\t ", &saveptr); char *next = strtok_r (line_buf, "\t ", &saveptr);