]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Fix BSS Termination Duration subelement length validation
authorJouni Malinen <jouni@codeaurora.org>
Fri, 24 May 2019 13:59:25 +0000 (16:59 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 24 May 2019 22:19:33 +0000 (01:19 +0300)
The length check for the BSS Termination Duration subelement was
accidentally removed and this could result in reading up to 10 bytes
beyond the end of a received frame. The actual read bytes would be
stored locally, but they were not used for anything, so other than
reading beyond the end of an allocated heap memory buffer, this did not
result in any behavior difference or exposure of the bytes.

Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14922
Fixes: 093226783dc7 ("WNM: Simplify how candidate subelements are stored")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/wnm_sta.c

index 22a21361ad8a47a3bb9f33536373140afc9e2c45..e6d7d6689bb00e9c5a0eb3c0811d962a6f617def 100644 (file)
@@ -451,6 +451,11 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
                rep->preference_present = 1;
                break;
        case WNM_NEIGHBOR_BSS_TERMINATION_DURATION:
+               if (elen < 10) {
+                       wpa_printf(MSG_DEBUG,
+                                  "WNM: Too short BSS termination duration");
+                       break;
+               }
                rep->bss_term_tsf = WPA_GET_LE64(pos);
                rep->bss_term_dur = WPA_GET_LE16(pos + 8);
                rep->bss_term_present = 1;