summaryrefslogtreecommitdiff
path: root/evutil.c
diff options
context:
space:
mode:
authorMark Ellzey <socket@gmail.com>2015-05-11 12:06:01 -0400
committerMark Ellzey <socket@gmail.com>2015-05-11 12:06:01 -0400
commit043ae7481f4a73b0f48055a0260afa454f02d136 (patch)
tree23677275df15aff328a6b4d1cb07ca694cc878b9 /evutil.c
parentf1b3a1e00725666b5ff8f767e2ca40039122e501 (diff)
downloadlibevent-043ae7481f4a73b0f48055a0260afa454f02d136.tar.gz
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.
Diffstat (limited to 'evutil.c')
-rw-r--r--evutil.c3
1 files changed, 3 insertions, 0 deletions
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)