Replace non-essential strncpy() calls.

This commit is contained in:
Todd C. Miller
2019-07-30 11:37:26 -06:00
parent aa73c86a5b
commit aa200cda6a
2 changed files with 6 additions and 4 deletions

View File

@@ -90,8 +90,10 @@ group_plugin_load(char *plugin_info)
savedch = *args;
*args = '\0';
}
strncpy(path, plugin_info, sizeof(path) - 1);
path[sizeof(path) - 1] = '\0';
if (strlcpy(path, plugin_info, sizeof(path)) >= sizeof(path)) {
fprintf(stderr, "path too long: %s\n", plugin_info);
return -1;
}
if (args != NULL)
*args++ = savedch;