🐞 fix(module manager): fix strncpy cppcheck warning
This commit is contained in:
@@ -213,7 +213,7 @@ struct stellar_module *stellar_module_manager_get_module(struct stellar_module_m
|
||||
struct stellar_module *stellar_module_new(const char *name)
|
||||
{
|
||||
struct stellar_module *mod = CALLOC(struct stellar_module, 1);
|
||||
strncpy(mod->name, name, NAME_MAX);
|
||||
memcpy(mod->name, name, MIN(NAME_MAX, strlen(name)));
|
||||
return mod;
|
||||
}
|
||||
|
||||
@@ -246,6 +246,6 @@ const char *stellar_module_get_name(struct stellar_module* mod)
|
||||
void stellar_module_set_name(struct stellar_module* mod, const char *name)
|
||||
{
|
||||
if(mod==NULL)return;
|
||||
strncpy(mod->name, name, NAME_MAX);
|
||||
memcpy(mod->name, name, MIN(NAME_MAX, strlen(name)));
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user