hostapd: clear ucode interface/bss resource pointers

Avoids potential use-after-free bugs

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2023-09-12 13:32:40 +02:00
parent 36a9f8449c
commit ea1787b7bc

View File

@ -298,9 +298,15 @@ uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx)
uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx)
{
uc_value_t *val = wpa_ucode_registry_get(reg, idx);
void **dataptr;
if (!val)
return NULL;
if (val)
ucv_array_set(reg, idx - 1, NULL);
dataptr = ucv_resource_dataptr(val, NULL);
if (dataptr)
*dataptr = NULL;
return val;
}