Reverted null character "fixes"

This reverts commit 62c21eb37f9bdc9570c53674daf2715373cb80f5.
This commit is contained in:
Václav Šmejkal 2022-05-26 17:44:04 +02:00
parent b84b8aa7cc
commit 0fed6e7f0c
2 changed files with 2 additions and 6 deletions

View File

@ -33,7 +33,7 @@ outputFlags decryptText(char *text, char *key, inputFlags flags)
} }
//SET LENGTH (numberBuffer) //SET LENGTH (numberBuffer)
returningText = malloc(numberBuffer + 1); returningText = malloc(numberBuffer);
textKeyChain = malloc(sizeof(int) * numberBuffer); textKeyChain = malloc(sizeof(int) * numberBuffer);
int encryptedTextKeyChain[sizeof(int) * numberBuffer]; int encryptedTextKeyChain[sizeof(int) * numberBuffer];
textKeyChainLength = numberBuffer; textKeyChainLength = numberBuffer;
@ -82,8 +82,6 @@ outputFlags decryptText(char *text, char *key, inputFlags flags)
returningText[i] = (char) textKeyChain[i]; returningText[i] = (char) textKeyChain[i];
} }
strcat(returningText, "\0");
//LOAD output //LOAD output
outputFlags output = outputFlags output =
{ {

View File

@ -14,7 +14,7 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags)
if (!flags.skipCheck) checkVersion(flags); if (!flags.skipCheck) checkVersion(flags);
//VARIABLES //VARIABLES
char *key = malloc(getKeyLength()); char *key = malloc(getKeyLength() + 1);
char *returningText; char *returningText;
char *textBuffer; char *textBuffer;
int *textKeyChain = malloc(sizeof(int) * strlen(text)); int *textKeyChain = malloc(sizeof(int) * strlen(text));
@ -107,8 +107,6 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags)
} }
} }
strcat(returningText, "\0");
//LOAD output //LOAD output
outputFlags output = outputFlags output =
{ {