Skip to content

Commit

Permalink
net/socket: fix coverity issue
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jensfr authored and jasowang committed Nov 13, 2017
1 parent 5e89dc0 commit bb160b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down

0 comments on commit bb160b5

Please sign in to comment.