Skip to content

Commit

Permalink
replace strncpy with snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
DomPeliniAerospike committed May 30, 2024
1 parent a098563 commit 922061a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/commands/info_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void *prepare(const Nan::FunctionCallbackInfo<v8::Value> &info)
}

Local<String> node_name = info[1].As<String>();
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));
Expand Down
3 changes: 1 addition & 2 deletions src/main/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ int config_from_jsobject(as_config *config, Local<Object> 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",
Expand Down

0 comments on commit 922061a

Please sign in to comment.