diff options
author | Nicholas Tay <nick@windblume.net> | 2022-01-11 21:50:37 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2022-01-11 21:50:42 +1100 |
commit | d42dfc07028fc77e9be0b1baca2aa4fd96214e98 (patch) | |
tree | f5e08943fdef0eca3cdb4985d8390c87086f3c84 /passgen.c | |
parent | 887ea0ad480c92679c71e3f88015fffe9c897ac2 (diff) | |
download | passgen-d42dfc07028fc77e9be0b1baca2aa4fd96214e98.tar.gz passgen-d42dfc07028fc77e9be0b1baca2aa4fd96214e98.tar.bz2 passgen-d42dfc07028fc77e9be0b1baca2aa4fd96214e98.zip |
Fix potential invalid free on password ptr
Diffstat (limited to '')
-rw-r--r-- | passgen.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -45,7 +45,7 @@ #ifdef USE_WINCRYPT -HCRYPTPROV win_rng; +HCRYPTPROV win_rng = NULL; #endif bool init_rng(void) { @@ -116,6 +116,7 @@ int main(int argc, char *argv[]) bool custom_grammar = false; char *grammar = DEFAULT_GRAMMAR; int grammar_size = sizeof(DEFAULT_GRAMMAR) - 1; + char *password = NULL; if (argc == 2) { /* Take first argument as the grammar */ @@ -134,7 +135,7 @@ int main(int argc, char *argv[]) custom_grammar = true; } - char *password = malloc(grammar_size + 1); + password = malloc(grammar_size + 1); if (password == NULL) { perror("malloc"); err = true; |