diff options
author | Mark Ellzey <socket@gmail.com> | 2015-05-11 12:06:01 -0400 |
---|---|---|
committer | Mark Ellzey <socket@gmail.com> | 2015-05-11 12:06:01 -0400 |
commit | 043ae7481f4a73b0f48055a0260afa454f02d136 (patch) | |
tree | 23677275df15aff328a6b4d1cb07ca694cc878b9 /evutil.c | |
parent | f1b3a1e00725666b5ff8f767e2ca40039122e501 (diff) | |
download | libevent-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.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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) |