From 607abcc7be089d7eaf30ad3a702aaaebba20c108 Mon Sep 17 00:00:00 2001 From: ngoto Date: Fri, 5 Jun 2015 16:11:47 +0000 Subject: [PATCH] * ext/socket/ancdata.c (bsock_sendmsg_internal): all arguments are parsed even on systems without HAVE_STRUCT_MSGHDR_MSG_CONTROL to prevent SEGV caused by passing Qnil to RARRAY_LENINT and to preserve behavior before r50776. [Bug #11224] [ruby-core:69468] [Bug #11225] [ruby-core:69469] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ ext/socket/ancdata.c | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71f4fe38b1..7343398ed0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Jun 6 01:00:06 2015 Naohisa Goto + + * ext/socket/ancdata.c (bsock_sendmsg_internal): all arguments are + parsed even on systems without HAVE_STRUCT_MSGHDR_MSG_CONTROL + to prevent SEGV caused by passing Qnil to RARRAY_LENINT and + to preserve behavior before r50776. + [Bug #11224] [ruby-core:69468] [Bug #11225] [ruby-core:69469] + Fri Jun 5 22:37:42 2015 Koichi Sasada * class.c (ins_methods_push): change 3rd parameter's type diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index ea55534d97..756cf7ed64 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -1151,11 +1151,8 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) if (argc == 0) rb_raise(rb_eArgError, "mesg argument required"); -#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) + rb_scan_args(argc, argv, "12*", &data, &vflags, &dest_sockaddr, &controls); -#else - rb_scan_args(argc, argv, "12", &data, &vflags, &dest_sockaddr); -#endif StringValue(data); controls_num = RARRAY_LENINT(controls);