bifcl: Ensure strncpy null-termination

This commit is contained in:
Jon Siwek 2020-07-03 23:55:07 -07:00 committed by Tim Wojtulewicz
parent a5a7f08c37
commit fe0b3dd13f

View file

@ -247,6 +247,7 @@ void init_alternative_mode()
static char name[1024]; static char name[1024];
strncpy(name, input_filename, sizeof(name) - 1); strncpy(name, input_filename, sizeof(name) - 1);
name[sizeof(name) - 1] = 0;
char* dot = strchr(name, '.'); char* dot = strchr(name, '.');
if ( dot ) if ( dot )
*dot = '\0'; *dot = '\0';
@ -255,6 +256,7 @@ void init_alternative_mode()
{ {
static char plugin_canon[1024]; static char plugin_canon[1024];
strncpy(plugin_canon, plugin, sizeof(plugin_canon) - 1); strncpy(plugin_canon, plugin, sizeof(plugin_canon) - 1);
plugin_canon[sizeof(plugin_canon) - 1] = 0;
char* colon = strstr(plugin_canon, "::"); char* colon = strstr(plugin_canon, "::");
if ( colon ) { if ( colon ) {