]> Git Repo - qemu.git/commitdiff
net/socket: fix coverity issue
authorJens Freimann <[email protected]>
Mon, 6 Nov 2017 14:05:46 +0000 (15:05 +0100)
committerJason Wang <[email protected]>
Mon, 13 Nov 2017 10:05:12 +0000 (18:05 +0800)
This fixes coverity issue CID1005339.

Make sure that saddr is not used uninitialized if the
mcast parameter is NULL.

Cc: [email protected]
Reported-by: Peter Maydell <[email protected]>
Signed-off-by: Jens Freimann <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
net/socket.c

index 83a2a31025b61aa0300366404b92beecb744535f..6917fbcbf582cf3606abe168a55918f262250bcc 100644 (file)
@@ -373,7 +373,7 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
     net_socket_read_poll(s, true);
 
     /* mcast: save bound address as dst */
-    if (is_connected) {
+    if (is_connected && mcast != NULL) {
         s->dgram_dst = saddr;
         snprintf(nc->info_str, sizeof(nc->info_str),
                  "socket: fd=%d (cloned mcast=%s:%d)",
This page took 0.028048 seconds and 4 git commands to generate.