ripd: clear sockaddr_in before using

ripd_create_socket() failed in bind() on Mac OS X 10.7 since there was garbage
in unused fields of struct sockaddr_in.

* ripd/ripd.c: zero out struct sockaddr_sin from before filling.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
Nick Hilliard 2012-08-18 15:10:57 +00:00 committed by David Lamparter
parent 1b54f798d3
commit bb2315f287

View File

@ -1475,6 +1475,7 @@ rip_send_packet (u_char * buf, int size, struct sockaddr_in *to,
sin.sin_addr.s_addr = htonl (INADDR_RIP_GROUP); sin.sin_addr.s_addr = htonl (INADDR_RIP_GROUP);
/* multicast send should bind to local interface address */ /* multicast send should bind to local interface address */
memset (&from, 0, sizeof (from));
from.sin_family = AF_INET; from.sin_family = AF_INET;
from.sin_port = htons (RIP_PORT_DEFAULT); from.sin_port = htons (RIP_PORT_DEFAULT);
from.sin_addr = ifc->address->u.prefix4; from.sin_addr = ifc->address->u.prefix4;