mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 03:13:44 +08:00
net/socket: fix coverity issue
This fixes coverity issue CID1005339. Make sure that saddr is not used uninitialized if the mcast parameter is NULL. Cc: qemu-stable@nongnu.org Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Jens Freimann <jfreimann@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
5e89dc0113
commit
bb160b571f
@ -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)",
|
||||
|
Loading…
Reference in New Issue
Block a user