mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
hostap: Silence compiler warnings about IFNAMSIZ buffers
Report interface name truncation and reject such cases in Host AP driver initialization of the AP interface. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
2ea1fce3d6
commit
b2f1e5458b
@ -231,7 +231,11 @@ static int hostap_init_sockets(struct hostap_driver_data *drv, u8 *own_addr)
|
||||
}
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%sap", drv->iface);
|
||||
if (os_snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%sap",
|
||||
drv->iface) >= (int) sizeof(ifr.ifr_name)) {
|
||||
wpa_printf(MSG_ERROR, "hostap: AP interface name truncated");
|
||||
return -1;
|
||||
}
|
||||
if (ioctl(drv->sock, SIOCGIFINDEX, &ifr) != 0) {
|
||||
wpa_printf(MSG_ERROR, "ioctl(SIOCGIFINDEX): %s",
|
||||
strerror(errno));
|
||||
@ -348,7 +352,10 @@ static int hostap_set_iface_flags(void *priv, int dev_up)
|
||||
struct ifreq ifr;
|
||||
char ifname[IFNAMSIZ];
|
||||
|
||||
os_snprintf(ifname, IFNAMSIZ, "%sap", drv->iface);
|
||||
if (os_snprintf(ifname, IFNAMSIZ, "%sap", drv->iface) >= IFNAMSIZ) {
|
||||
wpa_printf(MSG_ERROR, "hostap: AP interface name truncated");
|
||||
return -1;
|
||||
}
|
||||
if (linux_set_iface_flags(drv->ioctl_sock, ifname, dev_up) < 0)
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user