]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FT RRB: Clear pad field to avoid sending out uninitialized data
authorJouni Malinen <j@w1.fi>
Sat, 24 Aug 2013 21:35:10 +0000 (00:35 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 24 Aug 2013 21:35:10 +0000 (00:35 +0300)
The pad field in the RRB messages is unused, but it should be
initialized to avoid sending out arbitrary data from stack. This was
also generating number of valgrind complaints about uninitialized memory
accesses in local FT tests.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/ap/wpa_auth_ft.c

index 1bb5d97ae5e449365e44d86530dc8d009774c236..29d9d29ea72c98930e097888cef44722c76fdf32 100644 (file)
@@ -329,6 +329,7 @@ static int wpa_ft_pull_pmk_r1(struct wpa_authenticator *wpa_auth,
        os_memcpy(f.pmk_r0_name, pmk_r0_name, WPA_PMK_NAME_LEN);
        os_memcpy(f.r1kh_id, wpa_auth->conf.r1_key_holder, FT_R1KH_ID_LEN);
        os_memcpy(f.s1kh_id, s1kh_id, ETH_ALEN);
+       os_memset(f.pad, 0, sizeof(f.pad));
 
        if (aes_wrap(r0kh->key, (FT_R0KH_R1KH_PULL_DATA_LEN + 7) / 8,
                     f.nonce, frame.nonce) < 0)
@@ -1317,6 +1318,7 @@ static int wpa_ft_rrb_rx_pull(struct wpa_authenticator *wpa_auth,
        wpa_hexdump(MSG_DEBUG, "FT: PMKR1Name", r.pmk_r1_name,
                    WPA_PMK_NAME_LEN);
        r.pairwise = host_to_le16(pairwise);
+       os_memset(r.pad, 0, sizeof(r.pad));
 
        if (aes_wrap(r1kh->key, (FT_R0KH_R1KH_RESP_DATA_LEN + 7) / 8,
                     r.nonce, resp.nonce) < 0) {
@@ -1620,6 +1622,7 @@ static void wpa_ft_generate_pmk_r1(struct wpa_authenticator *wpa_auth,
        os_get_time(&now);
        WPA_PUT_LE32(f.timestamp, now.sec);
        f.pairwise = host_to_le16(pairwise);
+       os_memset(f.pad, 0, sizeof(f.pad));
        if (aes_wrap(r1kh->key, (FT_R0KH_R1KH_PUSH_DATA_LEN + 7) / 8,
                     f.timestamp, frame.timestamp) < 0)
                return;