aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Riihimäki <juha.riihimaki@nokia.com>2010-04-13 09:16:55 +0300
committerBlue Swirl <blauwirbel@gmail.com>2010-04-20 16:42:38 +0000
commitae1e6b3a8ef4e11e8c34e73721b6d9dfb891e103 (patch)
tree4816af899c0bccb37620c67bf2ad7911d9225a2d
parent3213c9e1e754ca38e47c3d618cc69b666f10fef9 (diff)
downloadslirp-ae1e6b3a8ef4e11e8c34e73721b6d9dfb891e103.zip
slirp-ae1e6b3a8ef4e11e8c34e73721b6d9dfb891e103.tar.gz
slirp-ae1e6b3a8ef4e11e8c34e73721b6d9dfb891e103.tar.bz2
slirp: fix structure initialization in tcp_listen()
A data structure of type sockaddr_in is allocated from stack but not properly initialized. This may lead to a failure in the bind() call later on. Fixed by filling the contents of the structure with zeroes before using it. Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/socket.c b/socket.c
index 2e926aa..569fd84 100644
--- a/socket.c
+++ b/socket.c
@@ -593,6 +593,7 @@ struct socket *tcp_listen(Slirp *slirp, u_int32_t haddr, u_int hport,
struct socket *so;
int s, opt = 1;
socklen_t addrlen = sizeof(addr);
+ memset(&addr, 0, addrlen);
DEBUG_CALL("tcp_listen");
DEBUG_ARG("haddr = %x", haddr);