From aa4a14998fa76927647cb7d0acf44af384bb4186 Mon Sep 17 00:00:00 2001 From: elegantShock2258 Date: Thu, 14 Oct 2021 16:28:59 +0530 Subject: [PATCH] FIXWARN : Provided limits to sscanf(), reduced scope of cache_enabled. --- uwufetch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/uwufetch.c b/uwufetch.c index 3b2546e..791d5d7 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -122,11 +122,13 @@ void remove_brackets(char *str); int main(int argc, char *argv[]) { char *cache_env = getenv("UWUFETCH_CACHE_ENABLED"); - int cache_enabled = 0; if (cache_env != NULL) - { + { + + int cache_enabled = 0; char buffer[128]; - sscanf(cache_env, "%[TRUEtrue1]", buffer); + + sscanf(cache_env, "%1[TRUEtrue1]", buffer); cache_enabled = (strcmp(buffer, "true") == 0 || strcmp(buffer, "TRUE") == 0 || strcmp(buffer, "1") == 0); if (cache_enabled) {