From 0fed6e7f0c28bfc27e36be5508ea47b87d53e699 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Thu, 26 May 2022 17:44:04 +0200 Subject: [PATCH] Reverted null character "fixes" This reverts commit 62c21eb37f9bdc9570c53674daf2715373cb80f5. --- src/lib/decrypter.c | 4 +--- src/lib/encrypter.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/lib/decrypter.c b/src/lib/decrypter.c index 6062bdd..0611f41 100644 --- a/src/lib/decrypter.c +++ b/src/lib/decrypter.c @@ -33,7 +33,7 @@ outputFlags decryptText(char *text, char *key, inputFlags flags) } //SET LENGTH (numberBuffer) - returningText = malloc(numberBuffer + 1); + returningText = malloc(numberBuffer); textKeyChain = malloc(sizeof(int) * numberBuffer); int encryptedTextKeyChain[sizeof(int) * numberBuffer]; textKeyChainLength = numberBuffer; @@ -82,8 +82,6 @@ outputFlags decryptText(char *text, char *key, inputFlags flags) returningText[i] = (char) textKeyChain[i]; } - strcat(returningText, "\0"); - //LOAD output outputFlags output = { diff --git a/src/lib/encrypter.c b/src/lib/encrypter.c index 334d697..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)); @@ -107,8 +107,6 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags) } } - strcat(returningText, "\0"); - //LOAD output outputFlags output = {