hostap: Fix interface name copy in removal
Using a macro here that can potentially limit the interface name compared to add can lead to issues, so, to mimic what we do in add, use the sizeof with a boundary check. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no> Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
d777c8654f
commit
26418cba14
|
@ -280,7 +280,13 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface)
|
|||
|
||||
supplicant_generate_state_event(ifname, NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING, 0);
|
||||
|
||||
os_memcpy(event->interface_status.ifname, ifname, IFNAMSIZ);
|
||||
if (sizeof(event->interface_status.ifname) < strlen(ifname)) {
|
||||
wpa_printf(MSG_ERROR, "Interface name too long: %s (max: %d)",
|
||||
ifname, sizeof(event->interface_status.ifname));
|
||||
goto out;
|
||||
}
|
||||
|
||||
os_memcpy(event->interface_status.ifname, ifname, strlen(ifname));
|
||||
event->interface_status.ievent = EVENT_INTERFACE_REMOVED;
|
||||
|
||||
msg.global = true;
|
||||
|
|
Loading…
Reference in a new issue