]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/qemu-xen-traditional.git/commitdiff
net: initialize parameters before use in net_socket_fd_init_dgram()
authorYunlei Ding <yunlei.ding@citrix.com>
Tue, 11 Mar 2014 09:55:59 +0000 (09:55 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 Oct 2015 15:52:07 +0000 (16:52 +0100)
Signed-off-by: Yunlei Ding <yunlei.ding@citrix.com>
Coverity-IDs: 1005339 1005340
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
net.c

diff --git a/net.c b/net.c
index 33460d86876c11cf549f870ecf79c8e06cfe1a56..8aba3c212b47702a67691b8f68a3c201e312b0ea 100644 (file)
--- 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