Skip to content

Commit

Permalink
fix: interface name length on copy to ifreq
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-burger committed Sep 24, 2024
1 parent bdf058a commit 828cd98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hw_sock_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ int hw_device_sock_raw_open(struct hw_sock_raw *phw_sock_raw, struct ec *pec, co
ec_log(10, "HW_OPEN", "binding raw socket to %s\n", devname);

(void)memset(&ifr, 0, sizeof(ifr));
(void)strncpy(ifr.ifr_name, devname, IFNAMSIZ);
(void)strncpy(ifr.ifr_name, devname, min(strlen(devname), IFNAMSIZ));
ioctl(phw_sock_raw->sockfd, SIOCGIFMTU, &ifr);
phw_sock_raw->common.mtu_size = ifr.ifr_mtu;
ec_log(10, "hw_open", "got mtu size %d\n", phw_sock_raw->common.mtu_size);
Expand Down

0 comments on commit 828cd98

Please sign in to comment.