Replace non-essential strncpy() calls.
This commit is contained in:
@@ -90,8 +90,10 @@ group_plugin_load(char *plugin_info)
|
|||||||
savedch = *args;
|
savedch = *args;
|
||||||
*args = '\0';
|
*args = '\0';
|
||||||
}
|
}
|
||||||
strncpy(path, plugin_info, sizeof(path) - 1);
|
if (strlcpy(path, plugin_info, sizeof(path)) >= sizeof(path)) {
|
||||||
path[sizeof(path) - 1] = '\0';
|
fprintf(stderr, "path too long: %s\n", plugin_info);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (args != NULL)
|
if (args != NULL)
|
||||||
*args++ = savedch;
|
*args++ = savedch;
|
||||||
|
|
||||||
|
@@ -309,7 +309,7 @@ get_net_ifs(char **addrinfo)
|
|||||||
|
|
||||||
#ifdef SIOCGIFFLAGS
|
#ifdef SIOCGIFFLAGS
|
||||||
memset(ifr_tmp, 0, sizeof(*ifr_tmp));
|
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)
|
if (ioctl(sock, SIOCGIFFLAGS, (caddr_t) ifr_tmp) < 0)
|
||||||
#endif
|
#endif
|
||||||
memcpy(ifr_tmp, ifr, sizeof(*ifr_tmp));
|
memcpy(ifr_tmp, ifr, sizeof(*ifr_tmp));
|
||||||
@@ -321,7 +321,7 @@ get_net_ifs(char **addrinfo)
|
|||||||
|
|
||||||
/* Get the netmask. */
|
/* Get the netmask. */
|
||||||
memset(ifr_tmp, 0, sizeof(*ifr_tmp));
|
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;
|
sin = (struct sockaddr_in *) &ifr_tmp->ifr_addr;
|
||||||
#ifdef _ISC
|
#ifdef _ISC
|
||||||
STRSET(SIOCGIFNETMASK, (caddr_t) ifr_tmp, sizeof(*ifr_tmp));
|
STRSET(SIOCGIFNETMASK, (caddr_t) ifr_tmp, sizeof(*ifr_tmp));
|
||||||
|
Reference in New Issue
Block a user