1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-01 20:38:14 +00:00

Fix segfault if a weak hash is detected for some fast hashes

This commit is contained in:
Jens Steube 2016-01-10 21:37:45 +01:00
parent 1d628ca6e0
commit 87dca98a51

View File

@ -1994,6 +1994,8 @@ static void check_hash (hc_device_param_t *device_param, const uint salt_pos, co
} }
} }
if (data.attack_mode == ATTACK_MODE_BF)
{
if (data.opti_type & OPTI_TYPE_BRUTE_FORCE) // lots of optimizations can happen here if (data.opti_type & OPTI_TYPE_BRUTE_FORCE) // lots of optimizations can happen here
{ {
if (data.opti_type & OPTI_TYPE_SINGLE_HASH) if (data.opti_type & OPTI_TYPE_SINGLE_HASH)
@ -2014,6 +2016,7 @@ static void check_hash (hc_device_param_t *device_param, const uint salt_pos, co
plain_len = plain_len / 2; plain_len = plain_len / 2;
} }
} }
}
// if enabled, update also the potfile // if enabled, update also the potfile
@ -4526,12 +4529,14 @@ static void weak_hash_check (hc_device_param_t *device_param, const uint salt_po
char *dictfile_old = data.dictfile; char *dictfile_old = data.dictfile;
char *dictfile2_old = data.dictfile2; char *dictfile2_old = data.dictfile2;
char *mask_old = data.mask; char *mask_old = data.mask;
int attack_mode_old = data.attack_mode;
const char *weak_hash_check = "weak-hash-check"; const char *weak_hash_check = "weak-hash-check";
data.dictfile = (char *) weak_hash_check; data.dictfile = (char *) weak_hash_check;
data.dictfile2 = (char *) weak_hash_check; data.dictfile2 = (char *) weak_hash_check;
data.mask = (char *) weak_hash_check; data.mask = (char *) weak_hash_check;
data.attack_mode = ATTACK_MODE_STRAIGHT;
/** /**
* run the kernel * run the kernel
@ -4584,6 +4589,7 @@ static void weak_hash_check (hc_device_param_t *device_param, const uint salt_po
data.dictfile = dictfile_old; data.dictfile = dictfile_old;
data.dictfile2 = dictfile2_old; data.dictfile2 = dictfile2_old;
data.mask = mask_old; data.mask = mask_old;
data.attack_mode = attack_mode_old;
} }
// hlfmt hashcat // hlfmt hashcat
@ -16466,10 +16472,13 @@ int main (int argc, char **argv)
if (device_param->kernel_tb) hc_clReleaseKernel (device_param->kernel_tb); if (device_param->kernel_tb) hc_clReleaseKernel (device_param->kernel_tb);
if (device_param->kernel_tm) hc_clReleaseKernel (device_param->kernel_tm); if (device_param->kernel_tm) hc_clReleaseKernel (device_param->kernel_tm);
if (device_param->kernel_amp) hc_clReleaseKernel (device_param->kernel_amp); if (device_param->kernel_amp) hc_clReleaseKernel (device_param->kernel_amp);
if (device_param->kernel_weak) hc_clReleaseKernel (device_param->kernel_weak);
if (device_param->program) hc_clReleaseProgram (device_param->program); if (device_param->program) hc_clReleaseProgram (device_param->program);
if (device_param->program_mp) hc_clReleaseProgram (device_param->program_mp); if (device_param->program_mp) hc_clReleaseProgram (device_param->program_mp);
if (device_param->program_amp) hc_clReleaseProgram (device_param->program_amp); if (device_param->program_amp) hc_clReleaseProgram (device_param->program_amp);
if (device_param->program_weak) hc_clReleaseProgram (device_param->program_weak);
if (device_param->command_queue) hc_clReleaseCommandQueue (device_param->command_queue); if (device_param->command_queue) hc_clReleaseCommandQueue (device_param->command_queue);
if (device_param->context) hc_clReleaseContext (device_param->context); if (device_param->context) hc_clReleaseContext (device_param->context);
} }