summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 15:17:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 15:17:49 +0000
commit792cfa3fd0251f3b9fd8993a16b5948bd852e6da (patch)
tree3887edc4cae285aee5051e0055319215606a1063 /ext/socket/socket.c
parent93c819aa716c96f4963155af7ca9bc02e93f087f (diff)
* ext/socket/sockport.h (VALIDATE_SOCKLEN): new macro to validate
sa_len member of 4.4BSD socket address. * ext/socket/getnameinfo.c (getnameinfo): use VALIDATE_SOCKLEN, instead of SA_LEN. * ext/socket/socket.c (sock_s_getnameinfo): use VALIDATE_SOCKLEN instead of SS_LEN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index bae6bf2..be3f8cc 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1235,7 +1235,7 @@ sock_s_getnameinfo(int argc, VALUE *argv)
rb_raise(rb_eTypeError, "sockaddr length too big");
}
memcpy(&ss, RSTRING_PTR(sa), RSTRING_LEN(sa));
- if ((size_t)RSTRING_LEN(sa) != SS_LEN(&ss)) {
+ if (!VALIDATE_SOCKLEN((struct sockaddr *)&ss, RSTRING_LEN(sa))) {
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
}
sap = (struct sockaddr*)&ss;