summaryrefslogtreecommitdiff
path: root/ext/socket/ipsocket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 11:28:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 11:28:49 +0000
commit18a8046d1c76209449f11207ba1140d4a6c28a1b (patch)
tree14247717863b13a34b621ebad11921b79760fcda /ext/socket/ipsocket.c
parent64db9dcbd5451f5f3ad4ef69662311a7cbb44a95 (diff)
downloadbundler-18a8046d1c76209449f11207ba1140d4a6c28a1b.tar.gz
* ext/socket: always operate length of socket addess companion with
socket address. * ext/socket/rubysocket.h (rsock_make_ipaddr): add an argument for socket address length. (rsock_ipaddr): ditto. * ext/socket/ipsocket.c (ip_addr): pass length to rsock_ipaddr. (ip_peeraddr): ditto. (ip_s_getaddress): pass length to rsock_make_ipaddr. * ext/socket/socket.c (make_addrinfo): pass length to rsock_ipaddr. (sock_s_getnameinfo): pass actual address length to rb_getnameinfo. (sock_s_unpack_sockaddr_in): pass length to rsock_make_ipaddr. * ext/socket/init.c (rsock_s_recvfrom): pass length to rsock_ipaddr. (rsock_s_recvfrom_nonblock): ditto. * ext/socket/tcpsocket.c (tcp_sockaddr): pass length to rsock_make_ipaddr. * ext/socket/raddrinfo.c (make_ipaddr0): add an argument for socket address length. pass the length to rb_getnameinfo. (rsock_ipaddr): ditto. (rsock_make_ipaddr): add an argument for socket address length. pass the length to make_ipaddr0. (make_inetaddr): pass length to make_ipaddr0. a local variable renamed. (host_str): a local variable renamed. (port_str): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/ipsocket.c')
-rw-r--r--ext/socket/ipsocket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index b1085cd70c..bd14ba9d89 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -194,7 +194,7 @@ ip_addr(int argc, VALUE *argv, VALUE sock)
norevlookup = fptr->mode & FMODE_NOREVLOOKUP;
if (getsockname(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
rb_sys_fail("getsockname(2)");
- return rsock_ipaddr((struct sockaddr*)&addr, norevlookup);
+ return rsock_ipaddr((struct sockaddr*)&addr, len, norevlookup);
}
/*
@@ -235,7 +235,7 @@ ip_peeraddr(int argc, VALUE *argv, VALUE sock)
norevlookup = fptr->mode & FMODE_NOREVLOOKUP;
if (getpeername(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
rb_sys_fail("getpeername(2)");
- return rsock_ipaddr((struct sockaddr*)&addr, norevlookup);
+ return rsock_ipaddr((struct sockaddr*)&addr, len, norevlookup);
}
/*
@@ -285,7 +285,7 @@ ip_s_getaddress(VALUE obj, VALUE host)
memcpy(&addr, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
- return rsock_make_ipaddr((struct sockaddr*)&addr);
+ return rsock_make_ipaddr((struct sockaddr*)&addr, res->ai_addrlen);
}
void