ruby-changes:48047
From: nobu <ko1@a...>
Date: Wed, 11 Oct 2017 15:16:08 +0900 (JST)
Subject: [ruby-changes:48047] nobu:r60161 (trunk): process.c: null byte at initgroups
nobu 2017-10-11 15:16:03 +0900 (Wed, 11 Oct 2017) New Revision: 60161 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60161 Log: process.c: null byte at initgroups * process.c (proc_initgroups): check null byte. patched by tommy (Masahiro Tomita) in [ruby-dev:50287]. [Bug #13995] Modified files: trunk/process.c trunk/test/ruby/test_process.rb Index: process.c =================================================================== --- process.c (revision 60160) +++ process.c (revision 60161) @@ -5948,7 +5948,7 @@ proc_setgroups(VALUE obj, VALUE ary) https://github.com/ruby/ruby/blob/trunk/process.c#L5948 static VALUE proc_initgroups(VALUE obj, VALUE uname, VALUE base_grp) { - if (initgroups(StringValuePtr(uname), OBJ2GID(base_grp)) != 0) { + if (initgroups(StringValueCStr(uname), OBJ2GID(base_grp)) != 0) { rb_sys_fail(0); } return proc_getgroups(obj); Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 60160) +++ test/ruby/test_process.rb (revision 60161) @@ -2339,4 +2339,12 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L2339 assert_equal pid, Timeout.timeout(30) { Process.wait(pid) } end; end + + if Process.respond_to?(:initgroups) + def test_initgroups + assert_raise(ArgumentError) do + Process.initgroups("\0", 0) + end + end + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/