]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_priv: Explicitly clear padding in message structures
authorJouni Malinen <j@w1.fi>
Sat, 3 Dec 2016 15:32:07 +0000 (17:32 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 3 Dec 2016 15:46:08 +0000 (17:46 +0200)
This avoids some valgrind warnings about use of uninitialized memory in
cases where a struct may have padding octets between the fields.

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

index 7b989ce4f410162c478bad20bf8e244ecdd43e36..11905f32839923199dd74b4f472b41a45c240bbb 100644 (file)
@@ -346,6 +346,7 @@ static void wpa_priv_cmd_get_ssid(struct wpa_priv_interface *iface,
        if (iface->driver->get_ssid == NULL)
                goto fail;
 
+       os_memset(ssid, 0, sizeof(ssid));
        res = iface->driver->get_ssid(iface->drv_priv, &ssid[sizeof(int)]);
        if (res < 0 || res > SSID_MAX_LEN)
                goto fail;
@@ -857,7 +858,7 @@ static void wpa_priv_send_auth(struct wpa_priv_interface *iface,
        struct privsep_event_auth *auth;
        u8 *buf, *pos;
 
-       buf = os_malloc(buflen);
+       buf = os_zalloc(buflen);
        if (buf == NULL)
                return;