From 577cf3056d9f3088145aea51bbc09a0c90a7695e Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 5 May 2011 11:49:01 -0700 Subject: connect: zero out hints argument for getaddrinfo Some systems like OpenBSD are stricter about irrelevant fields than GNU/Linux. [ew: commit message] ref: http://mid.gmane.org/20110505181846.GB9693@jeremyevans.local Acked-by: Eric Wong --- ext/kgio/connect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/kgio/connect.c b/ext/kgio/connect.c index 3b40054..bb1f527 100644 --- a/ext/kgio/connect.c +++ b/ext/kgio/connect.c @@ -69,6 +69,7 @@ static VALUE tcp_connect(VALUE klass, VALUE ip, VALUE port, int io_wait) rc = snprintf(ipport, sizeof(ipport), "%u", uport); if (rc >= (int)sizeof(ipport) || rc <= 0) rb_raise(rb_eArgError, "invalid TCP port: %u", uport); + memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; -- cgit v1.2.3-24-ge0c7