From 4aafe94dbd6ff255635e01189ede54ad05252bb6 Mon Sep 17 00:00:00 2001 From: Abhisha Nirmalathas <a.nirmalathas1@student.unimelb.edu.au> Date: Thu, 23 May 2019 20:39:44 +1000 Subject: [PATCH] debug --- four_password_strategy.c | 3 ++- six_password_strategy.c | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/four_password_strategy.c b/four_password_strategy.c index bb0bad3..82245c3 100644 --- a/four_password_strategy.c +++ b/four_password_strategy.c @@ -64,12 +64,13 @@ int popular_character_guess_four(HashTable *ht, Passwords* solved){ SHA256_CTX ctx; int hash; char line[20]; + memset(line, 0, 20); FILE *file = fopen("common_password_frequency.txt", "r"); char frequent_characters[60]; + memset(frequent_characters, 0, 60); int index = 0; // Ensures all passwords havent been guessed if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ - fclose(file); return 0; } while (fgets(line, sizeof(line), file)){ diff --git a/six_password_strategy.c b/six_password_strategy.c index 2d593e5..38b949c 100644 --- a/six_password_strategy.c +++ b/six_password_strategy.c @@ -75,7 +75,6 @@ int popular_character_guess_six(HashTable *ht, Passwords *solved){ int index = 0; // Ensures all passwords havent been guessed if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ - fclose(file); return 0; } while (fgets(line, sizeof(line), file)){ -- GitLab