diff --git a/src/main/commands/info_node.cc b/src/main/commands/info_node.cc index 7c5d6c40..291d8d60 100644 --- a/src/main/commands/info_node.cc +++ b/src/main/commands/info_node.cc @@ -81,7 +81,7 @@ static void *prepare(const Nan::FunctionCallbackInfo &info) } Local node_name = info[1].As(); - strncpy(cmd->node_name, *Nan::Utf8String(node_name), AS_NODE_NAME_SIZE); + snprintf(cmd->node_name, AS_NODE_NAME_SIZE, "%s", *Nan::Utf8String(node_name)); if (info[2]->IsObject()) { cmd->policy = (as_policy_info *)cf_malloc(sizeof(as_policy_info)); diff --git a/src/main/config.cc b/src/main/config.cc index 749274e9..4accfd89 100644 --- a/src/main/config.cc +++ b/src/main/config.cc @@ -360,8 +360,7 @@ int config_from_jsobject(as_config *config, Local configObj, goto Cleanup; } else if (defined) { - strncpy(config->lua.user_path, user_path, ((strlen(user_path) + 1) < AS_CONFIG_PATH_MAX_SIZE) ? - (strlen(user_path) + 1) : AS_CONFIG_PATH_MAX_SIZE); + snprintf(config->lua.user_path, AS_CONFIG_PATH_MAX_SIZE, "%s", user_path); } else { as_v8_debug(log, "Using default Lua user path: %s",