mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-15 12:29:35 +00:00
Remove some memsets
This commit is contained in:
parent
bc24e3d79b
commit
54c7c23ad4
111
src/oclHashcat.c
111
src/oclHashcat.c
@ -1352,9 +1352,7 @@ void status_display ()
|
|||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
char display_dev_cur[16];
|
char display_dev_cur[16] = { 0 };
|
||||||
|
|
||||||
memset (display_dev_cur, 0, sizeof (display_dev_cur));
|
|
||||||
|
|
||||||
strncpy (display_dev_cur, "0.00", 4);
|
strncpy (display_dev_cur, "0.00", 4);
|
||||||
|
|
||||||
@ -1363,9 +1361,7 @@ void status_display ()
|
|||||||
log_info ("Speed.Dev.#%d...: %9sH/s", device_id + 1, display_dev_cur);
|
log_info ("Speed.Dev.#%d...: %9sH/s", device_id + 1, display_dev_cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
char display_all_cur[16];
|
char display_all_cur[16] = { 0 };
|
||||||
|
|
||||||
memset (display_all_cur, 0, sizeof (display_all_cur));
|
|
||||||
|
|
||||||
strncpy (display_all_cur, "0.00", 4);
|
strncpy (display_all_cur, "0.00", 4);
|
||||||
|
|
||||||
@ -1618,9 +1614,7 @@ static void status_benchmark ()
|
|||||||
|
|
||||||
if (device_param->skipped) continue;
|
if (device_param->skipped) continue;
|
||||||
|
|
||||||
char display_dev_cur[16];
|
char display_dev_cur[16] = { 0 };
|
||||||
|
|
||||||
memset (display_dev_cur, 0, sizeof (display_dev_cur));
|
|
||||||
|
|
||||||
strncpy (display_dev_cur, "0.00", 4);
|
strncpy (display_dev_cur, "0.00", 4);
|
||||||
|
|
||||||
@ -1629,9 +1623,7 @@ static void status_benchmark ()
|
|||||||
log_info ("Speed.Dev.#%d.: %9sH/s", device_id + 1, display_dev_cur);
|
log_info ("Speed.Dev.#%d.: %9sH/s", device_id + 1, display_dev_cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
char display_all_cur[16];
|
char display_all_cur[16] = { 0 };
|
||||||
|
|
||||||
memset (display_all_cur, 0, sizeof (display_all_cur));
|
|
||||||
|
|
||||||
strncpy (display_all_cur, "0.00", 4);
|
strncpy (display_all_cur, "0.00", 4);
|
||||||
|
|
||||||
@ -1837,7 +1829,7 @@ static void check_hash (hc_device_param_t *device_param, const uint salt_pos, co
|
|||||||
|
|
||||||
// hash
|
// hash
|
||||||
|
|
||||||
char out_buf[4096]; memset (out_buf, 0, sizeof (out_buf));
|
char out_buf[4096] = { 0 };
|
||||||
|
|
||||||
ascii_digest (out_buf, salt_pos, digest_pos);
|
ascii_digest (out_buf, salt_pos, digest_pos);
|
||||||
|
|
||||||
@ -2242,11 +2234,8 @@ static void save_hash ()
|
|||||||
{
|
{
|
||||||
char *hashfile = data.hashfile;
|
char *hashfile = data.hashfile;
|
||||||
|
|
||||||
char new_hashfile[256];
|
char new_hashfile[256] = { 0 };
|
||||||
char old_hashfile[256];
|
char old_hashfile[256] = { 0 };
|
||||||
|
|
||||||
memset (new_hashfile, 0, sizeof (new_hashfile));
|
|
||||||
memset (old_hashfile, 0, sizeof (old_hashfile));
|
|
||||||
|
|
||||||
snprintf (new_hashfile, 255, "%s.new", hashfile);
|
snprintf (new_hashfile, 255, "%s.new", hashfile);
|
||||||
snprintf (old_hashfile, 255, "%s.old", hashfile);
|
snprintf (old_hashfile, 255, "%s.old", hashfile);
|
||||||
@ -2278,9 +2267,7 @@ static void save_hash ()
|
|||||||
|
|
||||||
if (data.hash_mode != 2500)
|
if (data.hash_mode != 2500)
|
||||||
{
|
{
|
||||||
char out_buf[4096];
|
char out_buf[4096] = { 0 };
|
||||||
|
|
||||||
memset (out_buf, 0, sizeof (out_buf));
|
|
||||||
|
|
||||||
if (data.username == 1)
|
if (data.username == 1)
|
||||||
{
|
{
|
||||||
@ -2760,9 +2747,7 @@ static void run_cracker (hc_device_param_t *device_param, const uint pw_cnt, con
|
|||||||
|
|
||||||
if (run_rule_engine (data.rule_len_r, data.rule_buf_r))
|
if (run_rule_engine (data.rule_len_r, data.rule_buf_r))
|
||||||
{
|
{
|
||||||
char rule_buf_out[BLOCK_SIZE];
|
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||||
|
|
||||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
|
||||||
|
|
||||||
int rule_len_out = _old_apply_rule (data.rule_buf_r, data.rule_len_r, line_buf, line_len, rule_buf_out);
|
int rule_len_out = _old_apply_rule (data.rule_buf_r, data.rule_len_r, line_buf, line_len, rule_buf_out);
|
||||||
|
|
||||||
@ -3143,9 +3128,7 @@ static void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *o
|
|||||||
|
|
||||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||||
{
|
{
|
||||||
char rule_buf_out[BLOCK_SIZE];
|
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||||
|
|
||||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
|
||||||
|
|
||||||
int rule_len_out = -1;
|
int rule_len_out = -1;
|
||||||
|
|
||||||
@ -3278,9 +3261,7 @@ static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t
|
|||||||
|
|
||||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||||
{
|
{
|
||||||
char rule_buf_out[BLOCK_SIZE];
|
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||||
|
|
||||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
|
||||||
|
|
||||||
int rule_len_out = -1;
|
int rule_len_out = -1;
|
||||||
|
|
||||||
@ -3637,9 +3618,7 @@ static void *thread_outfile_remove (void *p)
|
|||||||
int (*parse_func) (char *, uint, hash_t *) = data.parse_func;
|
int (*parse_func) (char *, uint, hash_t *) = data.parse_func;
|
||||||
|
|
||||||
// buffers
|
// buffers
|
||||||
hash_t hash_buf;
|
hash_t hash_buf = { 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
memset (&hash_buf, 0, sizeof (hash_buf));
|
|
||||||
|
|
||||||
hash_buf.digest = mymalloc (dgst_size);
|
hash_buf.digest = mymalloc (dgst_size);
|
||||||
|
|
||||||
@ -4016,9 +3995,7 @@ static void *thread_calc_stdin (void *p)
|
|||||||
|
|
||||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||||
{
|
{
|
||||||
char rule_buf_out[BLOCK_SIZE];
|
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||||
|
|
||||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
|
||||||
|
|
||||||
int rule_len_out = -1;
|
int rule_len_out = -1;
|
||||||
|
|
||||||
@ -4343,9 +4320,7 @@ static void *thread_calc (void *p)
|
|||||||
|
|
||||||
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
if (run_rule_engine (data.rule_len_l, data.rule_buf_l))
|
||||||
{
|
{
|
||||||
char rule_buf_out[BLOCK_SIZE];
|
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||||
|
|
||||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
|
||||||
|
|
||||||
int rule_len_out = -1;
|
int rule_len_out = -1;
|
||||||
|
|
||||||
@ -10102,9 +10077,7 @@ int main (int argc, char **argv)
|
|||||||
* potfile
|
* potfile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char potfile[256];
|
char potfile[256] = { 0 };
|
||||||
|
|
||||||
memset (potfile, 0, sizeof (potfile));
|
|
||||||
|
|
||||||
snprintf (potfile, sizeof (potfile) - 1, "%s/%s.pot", session_dir, session);
|
snprintf (potfile, sizeof (potfile) - 1, "%s/%s.pot", session_dir, session);
|
||||||
|
|
||||||
@ -10414,11 +10387,8 @@ int main (int argc, char **argv)
|
|||||||
* charsets : keep them together for more easy maintainnce
|
* charsets : keep them together for more easy maintainnce
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cs_t mp_sys[6];
|
cs_t mp_sys[6] = { { { 0 }, 0 } };
|
||||||
cs_t mp_usr[4];
|
cs_t mp_usr[4] = { { { 0 }, 0 } };
|
||||||
|
|
||||||
memset (mp_sys, 0, sizeof (mp_sys));
|
|
||||||
memset (mp_usr, 0, sizeof (mp_usr));
|
|
||||||
|
|
||||||
mp_setup_sys (mp_sys);
|
mp_setup_sys (mp_sys);
|
||||||
|
|
||||||
@ -12427,9 +12397,7 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
cl_platform_id platform = platforms[platform_id];
|
cl_platform_id platform = platforms[platform_id];
|
||||||
|
|
||||||
char platform_vendor[INFOSZ];
|
char platform_vendor[INFOSZ] = { 0 };
|
||||||
|
|
||||||
memset (platform_vendor, 0, sizeof (platform_vendor));
|
|
||||||
|
|
||||||
hc_clGetPlatformInfo (platform, CL_PLATFORM_VENDOR, sizeof (platform_vendor), platform_vendor, NULL);
|
hc_clGetPlatformInfo (platform, CL_PLATFORM_VENDOR, sizeof (platform_vendor), platform_vendor, NULL);
|
||||||
|
|
||||||
@ -12876,11 +12844,8 @@ int main (int argc, char **argv)
|
|||||||
* HM devices: init
|
* HM devices: init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hm_attrs_t hm_adapters_nv[DEVICES_MAX];
|
hm_attrs_t hm_adapters_nv[DEVICES_MAX] = { { { 0 }, 0, 0 } };
|
||||||
hm_attrs_t hm_adapters_amd[DEVICES_MAX];
|
hm_attrs_t hm_adapters_amd[DEVICES_MAX] = { { { 0 }, 0, 0 } };
|
||||||
|
|
||||||
memset (hm_adapters_nv, 0, sizeof (hm_adapters_nv));
|
|
||||||
memset (hm_adapters_amd, 0, sizeof (hm_adapters_amd));
|
|
||||||
|
|
||||||
if (gpu_temp_disable == 0)
|
if (gpu_temp_disable == 0)
|
||||||
{
|
{
|
||||||
@ -13354,9 +13319,7 @@ int main (int argc, char **argv)
|
|||||||
* kernel source filename
|
* kernel source filename
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char source_file[256];
|
char source_file[256] = { 0 };
|
||||||
|
|
||||||
memset (source_file, 0, sizeof (source_file));
|
|
||||||
|
|
||||||
generate_source_kernel_filename (attack_exec, attack_kern, kern_type, shared_dir, source_file);
|
generate_source_kernel_filename (attack_exec, attack_kern, kern_type, shared_dir, source_file);
|
||||||
|
|
||||||
@ -13373,9 +13336,7 @@ int main (int argc, char **argv)
|
|||||||
* kernel cached filename
|
* kernel cached filename
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char cached_file[256];
|
char cached_file[256] = { 0 };
|
||||||
|
|
||||||
memset (cached_file, 0, sizeof (cached_file));
|
|
||||||
|
|
||||||
generate_cached_kernel_filename (attack_exec, attack_kern, kern_type, profile_dir, device_name_chksum, cached_file);
|
generate_cached_kernel_filename (attack_exec, attack_kern, kern_type, profile_dir, device_name_chksum, cached_file);
|
||||||
|
|
||||||
@ -13485,9 +13446,7 @@ int main (int argc, char **argv)
|
|||||||
* kernel mp source filename
|
* kernel mp source filename
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char source_file[256];
|
char source_file[256] = { 0 };
|
||||||
|
|
||||||
memset (source_file, 0, sizeof (source_file));
|
|
||||||
|
|
||||||
generate_source_kernel_mp_filename (opti_type, opts_type, shared_dir, source_file);
|
generate_source_kernel_mp_filename (opti_type, opts_type, shared_dir, source_file);
|
||||||
|
|
||||||
@ -13504,9 +13463,7 @@ int main (int argc, char **argv)
|
|||||||
* kernel mp cached filename
|
* kernel mp cached filename
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char cached_file[256];
|
char cached_file[256] = { 0 };
|
||||||
|
|
||||||
memset (cached_file, 0, sizeof (cached_file));
|
|
||||||
|
|
||||||
generate_cached_kernel_mp_filename (opti_type, opts_type, profile_dir, device_name_chksum, cached_file);
|
generate_cached_kernel_mp_filename (opti_type, opts_type, profile_dir, device_name_chksum, cached_file);
|
||||||
|
|
||||||
@ -13598,9 +13555,7 @@ int main (int argc, char **argv)
|
|||||||
* kernel amp source filename
|
* kernel amp source filename
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char source_file[256];
|
char source_file[256] = { 0 };
|
||||||
|
|
||||||
memset (source_file, 0, sizeof (source_file));
|
|
||||||
|
|
||||||
generate_source_kernel_amp_filename (attack_kern, shared_dir, source_file);
|
generate_source_kernel_amp_filename (attack_kern, shared_dir, source_file);
|
||||||
|
|
||||||
@ -13617,9 +13572,7 @@ int main (int argc, char **argv)
|
|||||||
* kernel amp cached filename
|
* kernel amp cached filename
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char cached_file[256];
|
char cached_file[256] = { 0 };
|
||||||
|
|
||||||
memset (cached_file, 0, sizeof (cached_file));
|
|
||||||
|
|
||||||
generate_cached_kernel_amp_filename (attack_kern, profile_dir, device_name_chksum, cached_file);
|
generate_cached_kernel_amp_filename (attack_kern, profile_dir, device_name_chksum, cached_file);
|
||||||
|
|
||||||
@ -13947,9 +13900,7 @@ int main (int argc, char **argv)
|
|||||||
* kernel name
|
* kernel name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char kernel_name[64];
|
char kernel_name[64] = { 0 };
|
||||||
|
|
||||||
memset (kernel_name, 0, sizeof (kernel_name));
|
|
||||||
|
|
||||||
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
||||||
{
|
{
|
||||||
@ -15308,9 +15259,7 @@ int main (int argc, char **argv)
|
|||||||
data.css_cnt = css_cnt;
|
data.css_cnt = css_cnt;
|
||||||
data.css_buf = css_buf;
|
data.css_buf = css_buf;
|
||||||
|
|
||||||
uint uniq_tbls[SP_PW_MAX][CHARSIZ];
|
uint uniq_tbls[SP_PW_MAX][CHARSIZ] = { { 0 } };
|
||||||
|
|
||||||
memset (uniq_tbls, 0, sizeof (uniq_tbls));
|
|
||||||
|
|
||||||
mp_css_to_uniq_tbl (css_cnt, css_buf, uniq_tbls);
|
mp_css_to_uniq_tbl (css_cnt, css_buf, uniq_tbls);
|
||||||
|
|
||||||
@ -15758,9 +15707,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (maskpos > 0 && dictpos == 0) free (masks[maskpos - 1]);
|
if (maskpos > 0 && dictpos == 0) free (masks[maskpos - 1]);
|
||||||
|
|
||||||
uint uniq_tbls[SP_PW_MAX][CHARSIZ];
|
uint uniq_tbls[SP_PW_MAX][CHARSIZ] = { { 0 } };
|
||||||
|
|
||||||
memset (uniq_tbls, 0, sizeof (uniq_tbls));
|
|
||||||
|
|
||||||
mp_css_to_uniq_tbl (css_cnt, css_buf, uniq_tbls);
|
mp_css_to_uniq_tbl (css_cnt, css_buf, uniq_tbls);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user