From 635f9466714916df5c73cd4b70f6194b0c91dc54 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Mon, 11 Jul 2022 17:49:08 +0200 Subject: [PATCH] changed decrypter's 'encryptedTextKeyChain' allocation to heap --- src/lib/decrypter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/decrypter.c b/src/lib/decrypter.c index 65408c0..01c6909 100644 --- a/src/lib/decrypter.c +++ b/src/lib/decrypter.c @@ -46,6 +46,7 @@ outputFlags decryptText(char *text, char *keyNew) int textKeyChainLength; int *textKeyChain; char *key = malloc(strlen(keyNew) + 1); + int *encryptedTextKeyChain; //COPY keyNew TO key strcpy(key, keyNew); @@ -59,7 +60,7 @@ outputFlags decryptText(char *text, char *keyNew) //SET LENGTH (numberBuffer) returningText = malloc(numberBuffer + 1); textKeyChain = malloc(sizeof(int) * numberBuffer); - int encryptedTextKeyChain[sizeof(int) * numberBuffer]; + encryptedTextKeyChain = malloc(sizeof(int) * numberBuffer); textKeyChainLength = numberBuffer; //LOAD textKeyChain @@ -128,6 +129,7 @@ outputFlags decryptText(char *text, char *keyNew) //DEALLOCATION free(textKeyChain); + free(encryptedTextKeyChain); return output; }