Skip to content

Commit

Permalink
slirp: fix structure initialization in tcp_listen()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
  • Loading branch information
Juha Riihimäki authored and blueswirl committed Apr 20, 2010
1 parent d3538b4 commit ab07b98
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions slirp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ab07b98

Please sign in to comment.