summaryrefslogtreecommitdiff
path: root/ext/socket/ancdata.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-09 13:01:08 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-09 13:01:08 +0000
commit2ffbe0345dd606cffcc30cbfce437762f5fcb496 (patch)
treea7659cb44e9517b08c8eb367e6781fbcfa9d9d1c /ext/socket/ancdata.c
parentbfb334eefa6fdebcf95af0b44f27117b754d93c7 (diff)
* ext/socket/ancdata.c (bsock_sendmsg_internal): controls_num should
not be negative. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/ancdata.c')
-rw-r--r--ext/socket/ancdata.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index db5e7fd..3e6431e 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -1153,7 +1153,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
data = argv[0];
if (1 < argc) vflags = argv[1];
if (2 < argc) dest_sockaddr = argv[2];
- controls_num = argc - 3;
+ controls_num = 3 < argc ? argc - 3 : 0;
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (3 < argc) { controls_ptr = &argv[3]; }
#endif