]> git.proxmox.com Git - mirror_qemu.git/commitdiff
slirp: fix structure initialization in tcp_listen()
authorJuha Riihimäki <juha.riihimaki@nokia.com>
Tue, 13 Apr 2010 06:16:55 +0000 (09:16 +0300)
committerBlue Swirl <blauwirbel@gmail.com>
Tue, 20 Apr 2010 16:42:38 +0000 (16:42 +0000)
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>
slirp/socket.c

index 8a257acc83f82fa6ac87df98060712ba58c09bdb..eaad77af8d51a896a25e0fe3d44ee4afb2a64f4b 100644 (file)
@@ -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_CALL("tcp_listen");
        DEBUG_ARG("haddr = %x", haddr);