From 5661e886d8bfa39c16c708a1f2e6346c2a9c420c Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 27 Aug 2019 16:13:13 -0700 Subject: [PATCH] eap-wsc: fix valgrind warning Valgrind does not like uninitialized bytes used in a syscall. In this case the buffer is an out buffer but since valgrind doesn't know that it complains. Initializing to zero fixes the warning: Syscall param socketcall.sendto(msg) points to uninitialised byte(s) at 0x5162C4D: send (send.c:28) by 0x457AF4: l_checksum_update (checksum.c:319) by 0x43C03C: eap_wsc_handle_m2 (eap-wsc.c:842) by 0x43CD33: eap_wsc_handle_request (eap-wsc.c:1048) by 0x43A3A7: __eap_handle_request.part.0 (eap.c:266) by 0x41A426: eapol_rx_packet.part.12 (eapol.c:2262) by 0x41B536: __eapol_rx_packet (eapol.c:2650) by 0x407C80: netdev_control_port_frame_event (netdev.c:3542) by 0x407C80: netdev_unicast_notify (netdev.c:3684) by 0x4598C5: dispatch_unicast_watches (genl.c:899) by 0x4598C5: process_unicast (genl.c:918) by 0x4598C5: received_data (genl.c:1039) by 0x456452: io_callback (io.c:126) by 0x45569D: l_main_iterate (main.c:473) by 0x45576B: l_main_run (main.c:520) Address 0x1ffeffe290 is on thread 1's stack in frame #2, created by eap_wsc_handle_m2 (eap-wsc.c:797) --- src/eap-wsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eap-wsc.c b/src/eap-wsc.c index 8f463225..a78bd68e 100644 --- a/src/eap-wsc.c +++ b/src/eap-wsc.c @@ -797,7 +797,7 @@ static void eap_wsc_handle_m2(struct eap_state *eap, { struct eap_wsc_state *wsc = eap_get_data(eap); struct l_key *remote_public; - uint8_t shared_secret[192]; + uint8_t shared_secret[192] = { 0 }; size_t shared_secret_len = sizeof(shared_secret); struct l_checksum *sha256; uint8_t dhkey[32];