1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/syck/emitter.c (syck_emitter_write): str bigger than

e->bufsize causes buffer overflow.  [ruby-dev:22307]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-12-21 15:38:01 +00:00
parent f8b298c5f9
commit a7b3a42850
3 changed files with 17 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Mon Dec 22 00:32:43 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/syck/emitter.c (syck_emitter_write): str bigger than
e->bufsize causes buffer overflow. [ruby-dev:22307]
Sun Dec 21 17:29:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* class.c (rb_check_inheritable): new function. [ruby-dev:22316]

View file

@ -232,9 +232,18 @@ syck_emitter_write( SyckEmitter *e, char *str, long len )
* Flush if at end of buffer
*/
at = e->marker - e->buffer;
if ( len + at > e->bufsize )
if ( len + at >= e->bufsize )
{
syck_emitter_flush( e, 0 );
for (;;) {
long rest = e->bufsize - (e->marker - e->buffer);
if (len <= rest) break;
S_MEMCPY( e->marker, str, char, rest );
e->marker += len;
str += rest;
len -= rest;
syck_emitter_flush( e, 0 );
}
}
/*

View file

@ -845,7 +845,7 @@ syck_loader_initialize( self )
{
VALUE families;
rb_iv_set(self, "@families", rb_hash_new() );
rb_iv_set(self, "@families", rb_hash_new() );
rb_iv_set(self, "@private_types", rb_hash_new() );
rb_iv_set(self, "@anchors", rb_hash_new() );
families = rb_iv_get(self, "@families");
@ -853,7 +853,7 @@ syck_loader_initialize( self )
rb_hash_aset(families, rb_str_new2( YAML_DOMAIN ), rb_hash_new());
rb_hash_aset(families, rb_str_new2( RUBY_DOMAIN ), rb_hash_new());
return self;
return self;
}
/*