From: Yunlei Ding Date: Tue, 11 Mar 2014 09:55:59 +0000 (+0000) Subject: net: initialize parameters before use in net_socket_fd_init_dgram() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9da9f80538c8ff891886cfe3d987ca17bd240d19;p=people%2Fandrewcoop%2Fqemu-traditional.git net: initialize parameters before use in net_socket_fd_init_dgram() Signed-off-by: Yunlei Ding Coverity-IDs: 1005339 1005340 Reviewed-by: Andrew Cooper --- diff --git a/net.c b/net.c index 33460d86..8aba3c21 100644 --- a/net.c +++ b/net.c @@ -1316,9 +1316,11 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, { struct sockaddr_in saddr; int newfd; - socklen_t saddr_len; + socklen_t saddr_len = sizeof(saddr); NetSocketState *s; + memset(&saddr, 0, sizeof(saddr)); + /* fd passed: multicast: "learn" dgram_dst address from bound address and save it * Because this may be "shared" socket from a "master" process, datagrams would be recv() * by ONLY ONE process: we must "clone" this dgram socket --jjo