mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	debug.c: check codepage value [ci skip]
* debug.c (set_debug_option): check garbage and overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									5c9cd965be
								
							
						
					
					
						commit
						cdaf6db096
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								debug.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								debug.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -135,11 +135,15 @@ set_debug_option(const char *str, int len, void *arg)
 | 
			
		|||
# if RUBY_MSVCRT_VERSION >= 80
 | 
			
		||||
    SET_WHEN("rtc_error", ruby_w32_rtc_error, 1);
 | 
			
		||||
# endif
 | 
			
		||||
    if (NAME_MATCH_VALUE("codepage")) {
 | 
			
		||||
    {
 | 
			
		||||
	int ov;
 | 
			
		||||
	size_t retlen;
 | 
			
		||||
	ruby_w32_codepage =
 | 
			
		||||
	    ruby_scan_digits(str, len, 10, &retlen, &ov);
 | 
			
		||||
	unsigned long n;
 | 
			
		||||
	if (NAME_MATCH_VALUE("codepage") &&
 | 
			
		||||
	    (n = ruby_scan_digits(str, len, 10, &retlen, &ov),
 | 
			
		||||
	     (size_t)len == retlen && !ov)) {
 | 
			
		||||
	    ruby_w32_codepage = (UINT)n;
 | 
			
		||||
	}
 | 
			
		||||
	return;
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue