aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2021-12-01 16:04:37 +1100
committerNicholas Tay <nick@windblume.net>2021-12-01 16:07:59 +1100
commit4a00c265fe425c8a7fe2e6149cad96861212cec7 (patch)
treeadfe7065e9816a25d5836cb29050076fd969077f
parent9251761290fc3b521b18ef64a1e0b3d1ebe7cd08 (diff)
downloadpassgen-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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/passgen.c b/passgen.c
index bdcd04a..a4ff892 100644
--- a/passgen.c
+++ b/passgen.c
@@ -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);