diff options
author | Nicholas Tay <nick@windblume.net> | 2021-12-01 16:04:37 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2021-12-01 16:07:59 +1100 |
commit | 4a00c265fe425c8a7fe2e6149cad96861212cec7 (patch) | |
tree | adfe7065e9816a25d5836cb29050076fd969077f | |
parent | 9251761290fc3b521b18ef64a1e0b3d1ebe7cd08 (diff) | |
download | passgen-4a00c265fe425c8a7fe2e6149cad96861212cec7.tar.gz passgen-4a00c265fe425c8a7fe2e6149cad96861212cec7.tar.bz2 passgen-4a00c265fe425c8a7fe2e6149cad96861212cec7.zip |
Fix VLA for password chars
I wasn't very clued in on how this works, and I thought it'd initialise
properly, but clearly not. Need to include space for the null terminator
and explicitly set it.
-rw-r--r-- | passgen.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -48,7 +48,8 @@ int main(int argc, char *argv[]) //printf("Custom: %s\n", grammar);
}
- char password[grammar_size];
+ char password[grammar_size+1];
+ password[grammar_size] = 0;
// seed RNG; this isn't very good, but it's enough (for now)
srand(time(NULL) + getpid() % 420 - 69);
|