From 71115975bebfc82952309712a465e665527787d3 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Wed, 17 May 2023 10:25:10 -0700 Subject: [PATCH] [cli] Ensure that probed `libstdc++` path is NULL-terminated It appears that we were assuming our path was initialized with zeros, but that is not a safe assumption. --- cli/loader_lib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/loader_lib.c b/cli/loader_lib.c index e2f615c684637..a344910478ccd 100644 --- a/cli/loader_lib.c +++ b/cli/loader_lib.c @@ -345,6 +345,8 @@ static char *libstdcxxprobe(void) free(path); return NULL; } + // Ensure that `path` is zero-terminated. + path[pathlen] = '\0'; return path; } }