From 043ae7481f4a73b0f48055a0260afa454f02d136 Mon Sep 17 00:00:00 2001 From: Mark Ellzey Date: Mon, 11 May 2015 12:06:01 -0400 Subject: Fix garbage value in socketpair util function, stdint? * Fixed an issue with evutil_ersatz_socketpair_, listen_addr could all be compared against with agarbage values. So just memset it before using it anywhere. * Nick might punch me in the face, but if we have stdint.h; (as in EVENT__HAVE_STDINT_H is defined), might as well use those instead of the manual [U]INT[X}_MAX/MIN muck in there now. --- evutil.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'evutil.c') diff --git a/evutil.c b/evutil.c index 3d72e403..c77ddc85 100644 --- a/evutil.c +++ b/evutil.c @@ -257,6 +257,9 @@ evutil_ersatz_socketpair_(int family, int type, int protocol, connector = socket(AF_INET, type, 0); if (connector < 0) goto tidy_up_and_fail; + + memset(&connect_addr, 0, sizeof(connect_addr)); + /* We want to find out the port number to connect to. */ size = sizeof(connect_addr); if (getsockname(listener, (struct sockaddr *) &connect_addr, &size) == -1) -- cgit v1.2.1