fixed possible memory problems in decrypter
This commit is contained in:
parent
a1852354b4
commit
7b432df61d
@ -60,7 +60,7 @@ outputFlags decryptText(char *text, char *keyNew)
|
|||||||
//VARIABLES
|
//VARIABLES
|
||||||
char *returningText;
|
char *returningText;
|
||||||
int numberBuffer = 1;
|
int numberBuffer = 1;
|
||||||
char *textBuffer;
|
char *textBuffer = malloc(1);
|
||||||
int textKeyChainLength;
|
int textKeyChainLength;
|
||||||
int *textKeyChain;
|
int *textKeyChain;
|
||||||
char *key = malloc(strlen(keyNew) + 1);
|
char *key = malloc(strlen(keyNew) + 1);
|
||||||
@ -102,13 +102,7 @@ outputFlags decryptText(char *text, char *keyNew)
|
|||||||
numberBuffer++;
|
numberBuffer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != 0)
|
|
||||||
{
|
|
||||||
textBuffer = realloc(textBuffer, numberBuffer + 1);
|
textBuffer = realloc(textBuffer, numberBuffer + 1);
|
||||||
} else
|
|
||||||
{
|
|
||||||
textBuffer = malloc(numberBuffer + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//CLEAN (POSSIBLY EXISTING) JUNK in textBuffer
|
//CLEAN (POSSIBLY EXISTING) JUNK in textBuffer
|
||||||
for (int j = 0; j <= numberBuffer; j++)
|
for (int j = 0; j <= numberBuffer; j++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user