diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-02 14:53:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-02-02 14:53:36 +0000 |
commit | 729249159e34d20c8c9bf7529ef645fa8ca9de79 (patch) | |
tree | c4d13586e064b457b684aa063ebdc7f3fd47feee /ext/stringio | |
parent | 9b6581dc4771a77195a2f294ce89d249fc819733 (diff) | |
download | ruby-729249159e34d20c8c9bf7529ef645fa8ca9de79.tar.gz |
* ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended
part. [ruby-dev:25618]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r-- | ext/stringio/stringio.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index b31f1818b2..de96121367 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -934,10 +934,14 @@ strio_truncate(self, len) { VALUE string = writable(StringIO(self))->string; long l = NUM2LONG(len); + long plen = RSTRING(string)->len; if (l < 0) { error_inval("negative legnth"); } rb_str_resize(string, l); + if (plen < l) { + MEMZERO(RSTRING(string)->ptr + plen, char, l - plen); + } return len; } |