mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-16 15:20:42 +01:00
ap: verify ATTR_MAC exists in NEW_STATION
Caught by static analysis, if ATTR_MAC was not in the message there would be a memcpy with uninitialized bytes. In addition there is no reason to memcpy twice. Instead 'mac' can be a const pointer which both verifies it exists and removes the need for a second memcpy.
This commit is contained in:
parent
3a17c8e3c5
commit
5fcfb430b2
6
src/ap.c
6
src/ap.c
@ -2963,7 +2963,7 @@ static void ap_handle_new_station(struct ap_state *ap, struct l_genl_msg *msg)
|
|||||||
uint16_t type;
|
uint16_t type;
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
const void *data;
|
const void *data;
|
||||||
uint8_t mac[6];
|
const uint8_t *mac = NULL;
|
||||||
uint8_t *assoc_rsne = NULL;
|
uint8_t *assoc_rsne = NULL;
|
||||||
|
|
||||||
if (!l_genl_attr_init(&attr, msg))
|
if (!l_genl_attr_init(&attr, msg))
|
||||||
@ -2983,12 +2983,12 @@ static void ap_handle_new_station(struct ap_state *ap, struct l_genl_msg *msg)
|
|||||||
if (len != 6)
|
if (len != 6)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
memcpy(mac, data, 6);
|
mac = data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!assoc_rsne)
|
if (!assoc_rsne || !mac)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user