From 827a2a24e2c44ab0717ef7e2606afbd644b65613 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Tue, 26 Apr 2022 19:04:43 +0200 Subject: [PATCH] fixed possible memory leaks --- src/decrypter.c | 6 +++++- src/encrypter.c | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/decrypter.c b/src/decrypter.c index 1ed2cc8..a92c3fe 100644 --- a/src/decrypter.c +++ b/src/decrypter.c @@ -15,7 +15,11 @@ decryptText(char *text, char *key) fprintf(stderr, "Key must be at least %d characters long!\n", KEY_LENGTH); exit(INVALID_KEY); } - + + //REDEFINE KEY_LENGTH + #undef KEY_LENGTH + #define KEY_LENGTH strlen(key) + //VARIABLES char *returningText; int numberBuffer; diff --git a/src/encrypter.c b/src/encrypter.c index e84e9f3..a259871 100644 --- a/src/encrypter.c +++ b/src/encrypter.c @@ -34,6 +34,10 @@ encryptText(char *text, char *keyNew) strcpy(key, keyNew); + //REDEFINE KEY_LENGTH + /*#undef KEY_LENGTH + #define KEY_LENGTH strlen(key)*/ + goto skipKey; }