When make_mac_path() gets an error from efidp_make_mac_addr(), it fails
to close the file descriptor to the network device. So close it. Also
ensure that the ifrn_name field is NUL terminated.
Found by covscan.
Signed-off-by: Peter Jones <pjones@redhat.com>
memset(&ifr, 0, sizeof (ifr));
strncpy(ifr.ifr_name, ifname, IF_NAMESIZE);
+ ifr.ifr_name[IF_NAMESIZE-1] = '\0';
drvinfo.cmd = ETHTOOL_GDRVINFO;
ifr.ifr_data = (caddr_t)&drvinfo;
(uint8_t *)ifr.ifr_ifru.ifru_hwaddr.sa_data,
sizeof(ifr.ifr_ifru.ifru_hwaddr.sa_data));
if (sz < 0)
- return -1;
+ goto err;
+
off += sz;
ret = off;
err: