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:
parent
f8b298c5f9
commit
a7b3a42850
3 changed files with 17 additions and 3 deletions
|
@ -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]
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue