replaced malloc with strcpy with strdup
heh
This commit is contained in:
parent
4ec8edafcb
commit
bf96f9e55e
@ -63,16 +63,10 @@ outputFlags decryptText(char *text, char *keyNew)
|
|||||||
char *textBuffer = malloc(1);
|
char *textBuffer = malloc(1);
|
||||||
int textKeyChainLength;
|
int textKeyChainLength;
|
||||||
int *textKeyChain;
|
int *textKeyChain;
|
||||||
char *key = malloc(strlen(keyNew) + 1);
|
char *key = strdup(keyNew); //COPY keyNew TO key
|
||||||
int *encryptedTextKeyChain;
|
int *encryptedTextKeyChain;
|
||||||
char *usedText = malloc(strlen(text) + 1);
|
char *usedText = strdup(text); //COPY text TO usedText
|
||||||
char *usedTextCopy = usedText;
|
char *usedTextCopy = usedText; //TODO: wtf
|
||||||
|
|
||||||
//COPY keyNew TO key
|
|
||||||
strcpy(key, keyNew);
|
|
||||||
|
|
||||||
//COPY text TO usedText
|
|
||||||
strcpy(usedText, text);
|
|
||||||
|
|
||||||
//GET LENGTH OF returningText AND textKeyChain
|
//GET LENGTH OF returningText AND textKeyChain
|
||||||
for (int i = 0; i < (int) strlen(usedText); i++)
|
for (int i = 0; i < (int) strlen(usedText); i++)
|
||||||
|
@ -79,8 +79,7 @@ logFile initLogger(char *directoryPath)
|
|||||||
//CREATE SYMLINK
|
//CREATE SYMLINK
|
||||||
sprintf(latestBuffer, LOG_LATEST_FORMATTING, WRITE_DIR, LOG_LATEST); //GENERATE LATEST.log PATH
|
sprintf(latestBuffer, LOG_LATEST_FORMATTING, WRITE_DIR, LOG_LATEST); //GENERATE LATEST.log PATH
|
||||||
|
|
||||||
latestFilePath = malloc(strlen(filePath) + 1);
|
latestFilePath = strdup(filePath);
|
||||||
strcpy(latestFilePath, filePath);
|
|
||||||
|
|
||||||
if (access(latestBuffer, R_OK) == 0) { unlink(latestBuffer); } //REMOVE SYMLINK IF IT ALREADY EXISTS
|
if (access(latestBuffer, R_OK) == 0) { unlink(latestBuffer); } //REMOVE SYMLINK IF IT ALREADY EXISTS
|
||||||
(void) (symlink(latestFilePath + (strlen(WRITE_DIR) + 1), latestBuffer) + 1); //TODO: Try to create some function for processing exit value //CREATE
|
(void) (symlink(latestFilePath + (strlen(WRITE_DIR) + 1), latestBuffer) + 1); //TODO: Try to create some function for processing exit value //CREATE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user