Replace non-essential strncpy() calls.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -309,7 +309,7 @@ get_net_ifs(char **addrinfo)
|
||||
|
||||
#ifdef SIOCGIFFLAGS
|
||||
memset(ifr_tmp, 0, sizeof(*ifr_tmp));
|
||||
strncpy(ifr_tmp->ifr_name, ifr->ifr_name, sizeof(ifr_tmp->ifr_name) - 1);
|
||||
memcpy(ifr_tmp->ifr_name, ifr->ifr_name, sizeof(ifr_tmp->ifr_name));
|
||||
if (ioctl(sock, SIOCGIFFLAGS, (caddr_t) ifr_tmp) < 0)
|
||||
#endif
|
||||
memcpy(ifr_tmp, ifr, sizeof(*ifr_tmp));
|
||||
@@ -321,7 +321,7 @@ get_net_ifs(char **addrinfo)
|
||||
|
||||
/* Get the netmask. */
|
||||
memset(ifr_tmp, 0, sizeof(*ifr_tmp));
|
||||
strncpy(ifr_tmp->ifr_name, ifr->ifr_name, sizeof(ifr_tmp->ifr_name) - 1);
|
||||
memcpy(ifr_tmp->ifr_name, ifr->ifr_name, sizeof(ifr_tmp->ifr_name));
|
||||
sin = (struct sockaddr_in *) &ifr_tmp->ifr_addr;
|
||||
#ifdef _ISC
|
||||
STRSET(SIOCGIFNETMASK, (caddr_t) ifr_tmp, sizeof(*ifr_tmp));
|
||||
|
Reference in New Issue
Block a user