From 0a0803145c3c38e30dcdd71e21a48212b71b7ad7 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 19 Jun 2022 16:20:52 +0200 Subject: [PATCH] made noOutput safer it's now returning empty key of *VALID* keyLength --- src/lib/flags.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/flags.c b/src/lib/flags.c index 9a7f3e5..d677a0c 100644 --- a/src/lib/flags.c +++ b/src/lib/flags.c @@ -19,10 +19,15 @@ inputFlags noFlags() outputFlags noOutput(unsigned char exitCode) { - char *empty1 = malloc(1); - char *empty2 = malloc(1); + char *empty1 = malloc(1); //TEXT empty1[0] = '\0'; - empty2[0] = '\0'; + + char *empty2 = malloc(getKeyLength() + 1); //KEY + for (int i = 0; i < getKeyLength(); i++) + { + empty2[i] = 'x'; + } + empty2[getKeyLength()] = '\0'; return (outputFlags) { empty1, empty2, 0, 0, exitCode }; }