changed decrypter's 'encryptedTextKeyChain' allocation to heap

This commit is contained in:
Václav Šmejkal 2022-07-11 17:49:08 +02:00
parent 5482dcac2f
commit 635f946671
No known key found for this signature in database
GPG Key ID: FD749A97DF2D5E19

View File

@ -46,6 +46,7 @@ outputFlags decryptText(char *text, char *keyNew)
int textKeyChainLength; int textKeyChainLength;
int *textKeyChain; int *textKeyChain;
char *key = malloc(strlen(keyNew) + 1); char *key = malloc(strlen(keyNew) + 1);
int *encryptedTextKeyChain;
//COPY keyNew TO key //COPY keyNew TO key
strcpy(key, keyNew); strcpy(key, keyNew);
@ -59,7 +60,7 @@ outputFlags decryptText(char *text, char *keyNew)
//SET LENGTH (numberBuffer) //SET LENGTH (numberBuffer)
returningText = malloc(numberBuffer + 1); returningText = malloc(numberBuffer + 1);
textKeyChain = malloc(sizeof(int) * numberBuffer); textKeyChain = malloc(sizeof(int) * numberBuffer);
int encryptedTextKeyChain[sizeof(int) * numberBuffer]; encryptedTextKeyChain = malloc(sizeof(int) * numberBuffer);
textKeyChainLength = numberBuffer; textKeyChainLength = numberBuffer;
//LOAD textKeyChain //LOAD textKeyChain
@ -128,6 +129,7 @@ outputFlags decryptText(char *text, char *keyNew)
//DEALLOCATION //DEALLOCATION
free(textKeyChain); free(textKeyChain);
free(encryptedTextKeyChain);
return output; return output;
} }