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;
|
||||
|
||||
char display_dev_cur[16];
|
||||
|
||||
memset (display_dev_cur, 0, sizeof (display_dev_cur));
|
||||
char display_dev_cur[16] = { 0 };
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
char display_all_cur[16];
|
||||
|
||||
memset (display_all_cur, 0, sizeof (display_all_cur));
|
||||
char display_all_cur[16] = { 0 };
|
||||
|
||||
strncpy (display_all_cur, "0.00", 4);
|
||||
|
||||
@ -1618,9 +1614,7 @@ static void status_benchmark ()
|
||||
|
||||
if (device_param->skipped) continue;
|
||||
|
||||
char display_dev_cur[16];
|
||||
|
||||
memset (display_dev_cur, 0, sizeof (display_dev_cur));
|
||||
char display_dev_cur[16] = { 0 };
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
char display_all_cur[16];
|
||||
|
||||
memset (display_all_cur, 0, sizeof (display_all_cur));
|
||||
char display_all_cur[16] = { 0 };
|
||||
|
||||
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
|
||||
|
||||
char out_buf[4096]; memset (out_buf, 0, sizeof (out_buf));
|
||||
char out_buf[4096] = { 0 };
|
||||
|
||||
ascii_digest (out_buf, salt_pos, digest_pos);
|
||||
|
||||
@ -2242,11 +2234,8 @@ static void save_hash ()
|
||||
{
|
||||
char *hashfile = data.hashfile;
|
||||
|
||||
char new_hashfile[256];
|
||||
char old_hashfile[256];
|
||||
|
||||
memset (new_hashfile, 0, sizeof (new_hashfile));
|
||||
memset (old_hashfile, 0, sizeof (old_hashfile));
|
||||
char new_hashfile[256] = { 0 };
|
||||
char old_hashfile[256] = { 0 };
|
||||
|
||||
snprintf (new_hashfile, 255, "%s.new", hashfile);
|
||||
snprintf (old_hashfile, 255, "%s.old", hashfile);
|
||||
@ -2278,9 +2267,7 @@ static void save_hash ()
|
||||
|
||||
if (data.hash_mode != 2500)
|
||||
{
|
||||
char out_buf[4096];
|
||||
|
||||
memset (out_buf, 0, sizeof (out_buf));
|
||||
char out_buf[4096] = { 0 };
|
||||
|
||||
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))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE];
|
||||
|
||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
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))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE];
|
||||
|
||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
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))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE];
|
||||
|
||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
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;
|
||||
|
||||
// buffers
|
||||
hash_t hash_buf;
|
||||
|
||||
memset (&hash_buf, 0, sizeof (hash_buf));
|
||||
hash_t hash_buf = { 0, 0, 0, 0, 0 };
|
||||
|
||||
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))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE];
|
||||
|
||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
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))
|
||||
{
|
||||
char rule_buf_out[BLOCK_SIZE];
|
||||
|
||||
memset (rule_buf_out, 0, sizeof (rule_buf_out));
|
||||
char rule_buf_out[BLOCK_SIZE] = { 0 };
|
||||
|
||||
int rule_len_out = -1;
|
||||
|
||||
@ -10102,9 +10077,7 @@ int main (int argc, char **argv)
|
||||
* potfile
|
||||
*/
|
||||
|
||||
char potfile[256];
|
||||
|
||||
memset (potfile, 0, sizeof (potfile));
|
||||
char potfile[256] = { 0 };
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
cs_t mp_sys[6];
|
||||
cs_t mp_usr[4];
|
||||
|
||||
memset (mp_sys, 0, sizeof (mp_sys));
|
||||
memset (mp_usr, 0, sizeof (mp_usr));
|
||||
cs_t mp_sys[6] = { { { 0 }, 0 } };
|
||||
cs_t mp_usr[4] = { { { 0 }, 0 } };
|
||||
|
||||
mp_setup_sys (mp_sys);
|
||||
|
||||
@ -12427,9 +12397,7 @@ int main (int argc, char **argv)
|
||||
{
|
||||
cl_platform_id platform = platforms[platform_id];
|
||||
|
||||
char platform_vendor[INFOSZ];
|
||||
|
||||
memset (platform_vendor, 0, sizeof (platform_vendor));
|
||||
char platform_vendor[INFOSZ] = { 0 };
|
||||
|
||||
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_attrs_t hm_adapters_nv[DEVICES_MAX];
|
||||
hm_attrs_t hm_adapters_amd[DEVICES_MAX];
|
||||
|
||||
memset (hm_adapters_nv, 0, sizeof (hm_adapters_nv));
|
||||
memset (hm_adapters_amd, 0, sizeof (hm_adapters_amd));
|
||||
hm_attrs_t hm_adapters_nv[DEVICES_MAX] = { { { 0 }, 0, 0 } };
|
||||
hm_attrs_t hm_adapters_amd[DEVICES_MAX] = { { { 0 }, 0, 0 } };
|
||||
|
||||
if (gpu_temp_disable == 0)
|
||||
{
|
||||
@ -13354,9 +13319,7 @@ int main (int argc, char **argv)
|
||||
* kernel source filename
|
||||
*/
|
||||
|
||||
char source_file[256];
|
||||
|
||||
memset (source_file, 0, sizeof (source_file));
|
||||
char source_file[256] = { 0 };
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
char cached_file[256];
|
||||
|
||||
memset (cached_file, 0, sizeof (cached_file));
|
||||
char cached_file[256] = { 0 };
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
char source_file[256];
|
||||
|
||||
memset (source_file, 0, sizeof (source_file));
|
||||
char source_file[256] = { 0 };
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
char cached_file[256];
|
||||
|
||||
memset (cached_file, 0, sizeof (cached_file));
|
||||
char cached_file[256] = { 0 };
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
char source_file[256];
|
||||
|
||||
memset (source_file, 0, sizeof (source_file));
|
||||
char source_file[256] = { 0 };
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
char cached_file[256];
|
||||
|
||||
memset (cached_file, 0, sizeof (cached_file));
|
||||
char cached_file[256] = { 0 };
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
char kernel_name[64];
|
||||
|
||||
memset (kernel_name, 0, sizeof (kernel_name));
|
||||
char kernel_name[64] = { 0 };
|
||||
|
||||
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
||||
{
|
||||
@ -15308,9 +15259,7 @@ int main (int argc, char **argv)
|
||||
data.css_cnt = css_cnt;
|
||||
data.css_buf = css_buf;
|
||||
|
||||
uint uniq_tbls[SP_PW_MAX][CHARSIZ];
|
||||
|
||||
memset (uniq_tbls, 0, sizeof (uniq_tbls));
|
||||
uint uniq_tbls[SP_PW_MAX][CHARSIZ] = { { 0 } };
|
||||
|
||||
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]);
|
||||
|
||||
uint uniq_tbls[SP_PW_MAX][CHARSIZ];
|
||||
|
||||
memset (uniq_tbls, 0, sizeof (uniq_tbls));
|
||||
uint uniq_tbls[SP_PW_MAX][CHARSIZ] = { { 0 } };
|
||||
|
||||
mp_css_to_uniq_tbl (css_cnt, css_buf, uniq_tbls);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user