mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	process.c: null byte at initgroups
* process.c (proc_initgroups): check null byte. patched by tommy (Masahiro Tomita) in [ruby-dev:50287]. [Bug #13995] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									72c96011ea
								
							
						
					
					
						commit
						0c551b7a6d
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -5948,7 +5948,7 @@ proc_setgroups(VALUE obj, VALUE ary)
 | 
			
		|||
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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2339,4 +2339,12 @@ EOS
 | 
			
		|||
      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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue