mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-14 23:13:30 +00:00
slirp: Check qemu_socket() return value in udp_listen()
Check the return value from qemu_socket() rather than trying to pass it to bind() as an fd argument even if it's negative. This wouldn't have caused any negative consequences, because it won't be a valid fd number and the bind call will fail; but Coverity complains (CID 1005723). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
parent
6528a4c1f2
commit
4577b09a27
|
@ -335,6 +335,10 @@ udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
so->s = qemu_socket(AF_INET,SOCK_DGRAM,0);
|
so->s = qemu_socket(AF_INET,SOCK_DGRAM,0);
|
||||||
|
if (so->s < 0) {
|
||||||
|
sofree(so);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
so->so_expire = curtime + SO_EXPIRE;
|
so->so_expire = curtime + SO_EXPIRE;
|
||||||
insque(so, &slirp->udb);
|
insque(so, &slirp->udb);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue