From 4892883052f4970e0481dc5c1be36e45be6320bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20R=2E=20Miguel?= Date: Sun, 17 May 2020 23:55:17 -0300 Subject: [PATCH] Potential fix for #172 Adds a null-terminator to gCLIOpts.ConfigFile --- src/pc/cliopts.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pc/cliopts.c b/src/pc/cliopts.c index 514c1423..996b3086 100644 --- a/src/pc/cliopts.c +++ b/src/pc/cliopts.c @@ -13,6 +13,7 @@ void parse_cli_opts(int argc, char* argv[]) gCLIOpts.FullScreen = 0; gCLIOpts.ConfigFile = malloc(31); strncpy(gCLIOpts.ConfigFile, "sm64config.txt", strlen("sm64config.txt")); + gCLIOpts.ConfigFile[strlen("sm64config.txt") + 1] = '\0'; // Scan arguments for options if (argc > 1) @@ -48,6 +49,7 @@ void parse_cli_opts(int argc, char* argv[]) } else { memset(gCLIOpts.ConfigFile, 0, 30); strncpy(gCLIOpts.ConfigFile, argv[i+1], strlen(argv[i+1])); + gCLIOpts.ConfigFile[strlen(argv[i+1]) + 1] = '\0'; } } }