On Sun, Aug 05, 2018 at 06:35:05PM +0200, Florian Obser wrote:
> we just found the ess by comparing the nwid. It will not have
> magically changed behind our back.
>
> OK?
OK
By the way, this function has other small problems:
1) It assumes that len(nwid) == ic->ic_des_esslen which is only
true if nwid == ic->ic_des_essid. This happens to be the case
in the current call chain, but it would be better to either
get both from values from the ic or pass an nwid and a length.
2) essid comparison is done over IEEE80211_NWID_LEN bytes, but
we're copying only up to ic->ic_des_esslen bytes. This works
only because the remaining bytes happen to be zero.
I will send diffs for these issues soon.
> diff --git net80211/ieee80211_node.c net80211/ieee80211_node.c
> index d4561bffc06..a282ed5a333 100644
> --- net80211/ieee80211_node.c
> +++ net80211/ieee80211_node.c
> @@ -229,11 +229,10 @@ ieee80211_add_ess(struct ieee80211com *ic, char *nwid,
> int wpa, int wep)
> ess = malloc(sizeof(*ess), M_DEVBUF, M_NOWAIT|M_ZERO);
> if (ess == NULL)
> return (ENOMEM);
> + memcpy(ess->essid, nwid, ic->ic_des_esslen);
> + ess->esslen = ic->ic_des_esslen;
> }
>
> - memcpy(ess->essid, nwid, ic->ic_des_esslen);
> - ess->esslen = ic->ic_des_esslen;
> -
> if (wpa) {
> if (ic->ic_flags & (IEEE80211_F_RSNON|IEEE80211_F_PSK)) {
> ess->flags = IEEE80211_F_RSNON;
>
>
> --
> I'm not entirely sure you are real.
>