probably fixed deallocateOutput segfault
I thought the key returned as outputFlags (decrypter) was pointer to completely new address, but it often tried to deallocate unallocated key
This commit is contained in:
parent
903bcc63bf
commit
e94c273bd9
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
#include <why2/flags.h>
|
#include <why2/flags.h>
|
||||||
|
|
||||||
outputFlags decryptText(char *text, char *key, inputFlags flags); //TEXT from WILL BE DECRYPTED WITH KEY AND RETURNED
|
outputFlags decryptText(char *text, char *keyNew, inputFlags flags); //TEXT from WILL BE DECRYPTED WITH KEY AND RETURNED
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -7,13 +7,13 @@
|
|||||||
#include <why2/flags.h>
|
#include <why2/flags.h>
|
||||||
#include <why2/misc.h>
|
#include <why2/misc.h>
|
||||||
|
|
||||||
outputFlags decryptText(char *text, char *key, inputFlags flags)
|
outputFlags decryptText(char *text, char *keyNew, inputFlags flags)
|
||||||
{
|
{
|
||||||
//CHECK FOR INVALID key
|
//CHECK FOR INVALID key
|
||||||
checkKey(key, flags);
|
checkKey(keyNew, flags);
|
||||||
|
|
||||||
//REDEFINE keyLength
|
//REDEFINE keyLength
|
||||||
setKeyLength(strlen(key));
|
setKeyLength(strlen(keyNew));
|
||||||
|
|
||||||
//VARIABLES
|
//VARIABLES
|
||||||
char *returningText;
|
char *returningText;
|
||||||
@ -21,6 +21,10 @@ outputFlags decryptText(char *text, char *key, inputFlags flags)
|
|||||||
char *textBuffer;
|
char *textBuffer;
|
||||||
int textKeyChainLength;
|
int textKeyChainLength;
|
||||||
int *textKeyChain;
|
int *textKeyChain;
|
||||||
|
char *key = malloc(strlen(keyNew));
|
||||||
|
|
||||||
|
//COPY keyNew TO key
|
||||||
|
strcpy(key, keyNew);
|
||||||
|
|
||||||
//GET LENGTH OF returningText AND textKeyChain
|
//GET LENGTH OF returningText AND textKeyChain
|
||||||
for (int i = 0; i < strlen(text); i++)
|
for (int i = 0; i < strlen(text); i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user