if (len > 0)
{
vec_validate (socket_filename, len);
- strncpy ((char *) socket_filename, (char *) mp->socket_filename, len);
+ memcpy (socket_filename, mp->socket_filename, len);
}
rv = memif_socket_filename_add_del (is_add, socket_id, socket_filename);
memset (&ifr, 0, sizeof ifr);
memset (&drvinfo, 0, sizeof drvinfo);
ifr.ifr_data = (char *) &drvinfo;
- strncpy (ifr.ifr_name, e->d_name, IFNAMSIZ - 1);
+ strncpy (ifr.ifr_name, e->d_name, sizeof (ifr.ifr_name));
+ ifr.ifr_name[ARRAY_LEN (ifr.ifr_name) - 1] = '\0';
drvinfo.cmd = ETHTOOL_GDRVINFO;
if (ioctl (fd, SIOCETHTOOL, &ifr) < 0)
{
continue;
memset (&ifr, 0, sizeof (ifr));
- strncpy (ifr.ifr_name, e->d_name, IFNAMSIZ - 1);
+ strncpy (ifr.ifr_name, e->d_name, sizeof (ifr.ifr_name));
+ ifr.ifr_name[ARRAY_LEN (ifr.ifr_name) - 1] = '\0';
if (ioctl (fd, SIOCGIFFLAGS, &ifr) < 0)
{
error = clib_error_return_unix (0, "ioctl fetch intf %s flags",
if (am->msg_range_by_name == 0)
goto out;
-
- strncpy ((char *) name, (char *) mp->name, ARRAY_LEN (name) - 1);
-
+ strncpy ((char *) name, (char *) mp->name, ARRAY_LEN (name));
+ name[ARRAY_LEN (name) - 1] = '\0';
p = hash_get_mem (am->msg_range_by_name, name);
if (p == 0)
goto out;
rmp->api_versions[i].major = htonl (vl->major);
rmp->api_versions[i].minor = htonl (vl->minor);
rmp->api_versions[i].patch = htonl (vl->patch);
- strncpy ((char *) rmp->api_versions[i].name, vl->name, 64 - 1);
+ strncpy ((char *) rmp->api_versions[i].name, vl->name,
+ ARRAY_LEN (rmp->api_versions[i].name));
+ rmp->api_versions[i].name[ARRAY_LEN (rmp->api_versions[i].name) - 1] =
+ '\0';
}
vl_api_send_msg (reg, (u8 *) rmp);
vuid->is_server = vui->unix_server_index != ~0;
vuid->sock_errno = vui->sock_errno;
strncpy ((char *) vuid->sock_filename, (char *) vui->sock_filename,
- ARRAY_LEN (vuid->sock_filename) - 1);
-
+ sizeof (vuid->sock_filename));
+ vuid->sock_filename[ARRAY_LEN (vuid->sock_filename) - 1] = '\0';
s = format (s, "%v%c", hi->name, 0);
strncpy ((char *) vuid->if_name, (char *) s,