[PATCH] hostap: clean beacon_data before usage

Jouni Malinen j
Fri Nov 22 13:19:04 PST 2013

On Fri, Nov 22, 2013 at 09:21:25PM +0100, Janusz Dziedzic wrote:
> struct beacon_data contains a lot of pointers.
> We should clean them before usage. In other case
> we could have garbage there and next segfaults.
> Eg.
> nl80211_switch_channel() ../src/drivers/driver_nl80211.c:11323
> or os_free() issues.

> Found during DFS and CSA testing.

Are you saying this causes segfaults on some path?

> diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
> @@ -2049,6 +2049,7 @@ static int hostapd_build_beacon_data(struct hostapd_iface *iface,
> +	os_memset(beacon, 0, sizeof(*beacon));
>  	ret = ieee802_11_build_ap_params(hapd, &params);

That looks like a fine change, but I would like to understand on which
code path this is needed. I think I reviewed this when applying the
patch and hostapd_parse_csa_settings() included a memset for the full
csa_settings structure which should include the beacon data as well. Did
I miss some code paths where that memset does not get executed?

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list