]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Explicitly clear the temporary stack-based key for WPA-None
authorJouni Malinen <j@w1.fi>
Mon, 29 Dec 2014 11:09:24 +0000 (13:09 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 29 Dec 2014 17:44:51 +0000 (19:44 +0200)
There is no need to leave this temporary key in stack memory after
having been configured to the driver.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/wpa_supplicant.c

index 329d0d06af78f3af5d408d868605cdc399c86110..3dfa61a4163ec98e018bd9d7e76db282f387907e 100644 (file)
@@ -132,6 +132,7 @@ int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
        size_t keylen;
        enum wpa_alg alg;
        u8 seq[6] = { 0 };
+       int ret;
 
        /* IBSS/WPA-None uses only one key (Group) for both receiving and
         * sending unicast and multicast packets. */
@@ -175,7 +176,9 @@ int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
        /* TODO: should actually remember the previously used seq#, both for TX
         * and RX from each STA.. */
 
-       return wpa_drv_set_key(wpa_s, alg, NULL, 0, 1, seq, 6, key, keylen);
+       ret = wpa_drv_set_key(wpa_s, alg, NULL, 0, 1, seq, 6, key, keylen);
+       os_memset(key, 0, sizeof(key));
+       return ret;
 }