fixed decryption returningText bugs

I forgot that newly allocated text has some content....
This commit is contained in:
Václav Šmejkal 2022-05-29 16:44:14 +02:00
parent 0d64f4fa7c
commit ac82127bcc

View File

@ -42,7 +42,7 @@ outputFlags decryptText(char *text, char *keyNew, inputFlags flags)
generateTextKeyChain(key, textKeyChain, numberBuffer);
//LOAD encryptedTextKeyChain
for (int i = 0; i < (sizeof(encryptedTextKeyChain) / sizeof(int)); i++)
for (int i = 0; i < textKeyChainLength; i++)
{
numberBuffer = 0;
@ -76,10 +76,17 @@ outputFlags decryptText(char *text, char *keyNew, inputFlags flags)
textKeyChain[i] -= encryptedTextKeyChain[i];
}
//FIX returningText
strcpy(returningText, "");
for (int i = 0; i < textKeyChainLength; i++)
{
strcat(returningText, " ");
}
//LOAD returningText
for (int i = 0; i < textKeyChainLength; i++)
{
returningText[i] = (char) textKeyChain[i];
returningText[i] = textKeyChain[i];
}
//LOAD output