We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ead7efe commit 1f651d1Copy full SHA for 1f651d1
opal/util/ethtool.c
@@ -58,6 +58,8 @@ opal_ethtool_get_speed (const char *if_name)
58
59
memset(&ifr, 0, sizeof(struct ifreq));
60
strncpy(ifr.ifr_name, if_name, IF_NAMESIZE);
61
+ /* strncpy does not null terminate when the string is truncated */
62
+ ifr.ifr_name[IF_NAMESIZE-1] = '\0';
63
ifr.ifr_data = (char *)&edata;
64
65
if (ioctl(sockfd, SIOCETHTOOL, &ifr) < 0) {
0 commit comments