mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	win32.c: memcpy instead of strlcpy
* win32/win32.c (cmdglob): memcpy the exact size instead of strlcpy with +1. * win32/win32.c (w32_cmdvector): ditto, with NUL-terminating. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									12cccce6f6
								
							
						
					
					
						commit
						9019934c64
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1566,7 +1566,7 @@ cmdglob(NtCmdLineElement *patt, NtCmdLineElement **tail, UINT cp, rb_encoding *e
 | 
			
		|||
    if (patt->len >= PATH_MAX)
 | 
			
		||||
	if (!(buf = malloc(patt->len + 1))) return 0;
 | 
			
		||||
 | 
			
		||||
    strlcpy(buf, patt->str, patt->len + 1);
 | 
			
		||||
    memcpy(buf, patt->str, patt->len);
 | 
			
		||||
    buf[patt->len] = '\0';
 | 
			
		||||
    translate_char(buf, '\\', '/', cp);
 | 
			
		||||
    status = ruby_brace_glob_with_enc(buf, 0, insert, (VALUE)&tail, enc);
 | 
			
		||||
| 
						 | 
				
			
			@ -1864,7 +1864,8 @@ w32_cmdvector(const WCHAR *cmd, char ***vec, UINT cp, rb_encoding *enc)
 | 
			
		|||
    cptr = buffer + (elements+1) * sizeof(char *);
 | 
			
		||||
 | 
			
		||||
    while ((curr = cmdhead) != 0) {
 | 
			
		||||
	strlcpy(cptr, curr->str, curr->len + 1);
 | 
			
		||||
	memcpy(cptr, curr->str, curr->len);
 | 
			
		||||
	cptr[curr->len] = '\0';
 | 
			
		||||
	*vptr++ = cptr;
 | 
			
		||||
	cptr += curr->len + 1;
 | 
			
		||||
	cmdhead = curr->next;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue