[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] slirp: fix structure initialization in tcp_listen()

From: juha . riihimaki
Subject: [Qemu-devel] [PATCH] slirp: fix structure initialization in tcp_listen()
Date: Tue, 13 Apr 2010 09:16:55 +0300

From: Juha Riihimäki <address@hidden>

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 <address@hidden>
 slirp/socket.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/slirp/socket.c b/slirp/socket.c
index 8a257ac..eaad77a 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -587,6 +587,7 @@ tcp_listen(Slirp *slirp, u_int32_t haddr, u_int hport, 
u_int32_t laddr,
        struct socket *so;
        int s, opt = 1;
        socklen_t addrlen = sizeof(addr);
+       memset(&addr, 0, addrlen);
        DEBUG_ARG("haddr = %x", haddr);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]