From 5093d2395f5bef55c57181284d11fdcc4b5e247c Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 25 May 2022 17:58:19 +0200 Subject: [PATCH] added NULL character to generated key --- src/lib/encrypter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/encrypter.c b/src/lib/encrypter.c index a51f06c..a5ea709 100644 --- a/src/lib/encrypter.c +++ b/src/lib/encrypter.c @@ -14,7 +14,7 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags) if (!flags.skipCheck) checkVersion(flags); //VARIABLES - char *key = malloc(getKeyLength()); + char *key = malloc(getKeyLength() + 1); char *returningText; char *textBuffer; int *textKeyChain = malloc(sizeof(int) * strlen(text)); @@ -61,6 +61,8 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags) key[i] = (char) numberBuffer; } + key[getKeyLength()] = '\0'; //TODO: CHECK IF THIS CAN'T CAUSE SOME LITTLE TROUBLES (SHOULDN'T) + skipKey: //LOAD textKeyChain