From fe0b3dd13f4b1c7f9fa1d20237fee1bac5d9c73f Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Fri, 3 Jul 2020 23:55:07 -0700 Subject: [PATCH] bifcl: Ensure strncpy null-termination --- tools/bifcl/builtin-func.l | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/bifcl/builtin-func.l b/tools/bifcl/builtin-func.l index 2382da0f24..841168ca6b 100644 --- a/tools/bifcl/builtin-func.l +++ b/tools/bifcl/builtin-func.l @@ -247,6 +247,7 @@ void init_alternative_mode() static char name[1024]; strncpy(name, input_filename, sizeof(name) - 1); + name[sizeof(name) - 1] = 0; char* dot = strchr(name, '.'); if ( dot ) *dot = '\0'; @@ -255,6 +256,7 @@ void init_alternative_mode() { static char plugin_canon[1024]; strncpy(plugin_canon, plugin, sizeof(plugin_canon) - 1); + plugin_canon[sizeof(plugin_canon) - 1] = 0; char* colon = strstr(plugin_canon, "::"); if ( colon ) {