From: Jouni Malinen Date: Tue, 23 Jul 2024 21:36:46 +0000 (+0000) Subject: RSNO: Support over two octets of RSNXOE capabilities X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb61f6cb9561688b736a9895f63d0840e2257507;p=thirdparty%2Fhostap.git RSNO: Support over two octets of RSNXOE capabilities The RSNXE generation function was extended to support this earlier, but that update was missed from the RSNXOE variant. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/wpa_auth_ie.c b/src/ap/wpa_auth_ie.c index 79dbe346c..9a02f8e5d 100644 --- a/src/ap/wpa_auth_ie.c +++ b/src/ap/wpa_auth_ie.c @@ -547,15 +547,20 @@ static int wpa_write_rsnxe_override(struct wpa_auth_config *conf, u8 *buf, size_t len) { u8 *pos = buf; - u16 capab; + u32 capab, tmp; size_t flen; capab = rsnxe_capab(conf, conf->rsn_override_key_mgmt | conf->rsn_override_key_mgmt_2); - flen = (capab & 0xff00) ? 2 : 1; if (!capab) return 0; /* no supported extended RSN capabilities */ + tmp = capab; + flen = 0; + while (tmp) { + flen++; + tmp >>= 8; + } if (len < 2 + flen) return -1; capab |= flen - 1; /* bit 0-3 = Field length (n - 1) */ @@ -565,10 +570,10 @@ static int wpa_write_rsnxe_override(struct wpa_auth_config *conf, u8 *buf, WPA_PUT_BE32(pos, RSNXE_OVERRIDE_IE_VENDOR_TYPE); pos += 4; - *pos++ = capab & 0x00ff; - capab >>= 8; - if (capab) - *pos++ = capab; + while (capab) { + *pos++ = capab & 0xff; + capab >>= 8; + } return pos - buf; }