diff --git a/four_password_strategy.c b/four_password_strategy.c index bb0bad32551698c4e1a7d7c96d140a88ac470e74..82245c3088953caca339ff0a2d2cee369991c013 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 2d593e5921175fbbae8abce44cf610ef93b2390e..38b949cce8aa3109b211e5354e8f0a590b2317d1 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)){