mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* pack.c (pack_pack): check argument overrun for 'P'. based on a
patch by rucila <rucila at yahoo.cojp>. fixed: [ruby-dev:29182] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									140fad80c9
								
							
						
					
					
						commit
						9b4a611547
					
				
					 2 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,8 @@
 | 
			
		|||
Fri Aug  4 13:56:51 2006  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* pack.c (pack_pack): check argument overrun for 'P'.  based on a
 | 
			
		||||
	  patch by rucila <rucila at yahoo.cojp>.  fixed: [ruby-dev:29182]
 | 
			
		||||
 | 
			
		||||
Fri Aug  4 01:28:19 2006  Tanaka Akira  <akr@fsij.org>
 | 
			
		||||
 | 
			
		||||
	* io.c (io_reopen): STDERR.reopen(File.open("/dev/null", "w")) should
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								pack.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								pack.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -360,6 +360,7 @@ num2i32(VALUE x)
 | 
			
		|||
#else
 | 
			
		||||
# define QUAD_SIZE 8
 | 
			
		||||
#endif
 | 
			
		||||
static const char toofew[] = "too few arguments";
 | 
			
		||||
 | 
			
		||||
static void encodes(VALUE,const char*,long,int);
 | 
			
		||||
static void qpencode(VALUE,VALUE,long);
 | 
			
		||||
| 
						 | 
				
			
			@ -454,8 +455,9 @@ pack_pack(VALUE ary, VALUE fmt)
 | 
			
		|||
    items = RARRAY(ary)->len;
 | 
			
		||||
    idx = 0;
 | 
			
		||||
 | 
			
		||||
#define THISFROM RARRAY(ary)->ptr[idx]
 | 
			
		||||
#define NEXTFROM (items-- > 0 ? RARRAY(ary)->ptr[idx++] : (rb_raise(rb_eArgError, "too few arguments"),0))
 | 
			
		||||
#define TOO_FEW (rb_raise(rb_eArgError, toofew), 0)
 | 
			
		||||
#define THISFROM (items > 0 ? RARRAY(ary)->ptr[idx] : TOO_FEW)
 | 
			
		||||
#define NEXTFROM (items-- > 0 ? RARRAY(ary)->ptr[idx++] : TOO_FEW)
 | 
			
		||||
 | 
			
		||||
    while (p < pend) {
 | 
			
		||||
	if (RSTRING(fmt)->ptr + RSTRING(fmt)->len != pend) {
 | 
			
		||||
| 
						 | 
				
			
			@ -488,7 +490,7 @@ pack_pack(VALUE ary, VALUE fmt)
 | 
			
		|||
	}
 | 
			
		||||
	if (*p == '*') {	/* set data length */
 | 
			
		||||
	    len = strchr("@Xxu", type) ? 0 : items;
 | 
			
		||||
            p++;
 | 
			
		||||
	    p++;
 | 
			
		||||
	}
 | 
			
		||||
	else if (ISDIGIT(*p)) {
 | 
			
		||||
	    len = strtoul(p, (char**)&p, 10);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue