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 | c90479e5d3986a24e5bbf432484d48c4cd2e8d3f (patch) | |
tree | 8e63277e52eb46c10c83ca2406afae139c26f3a5 /ext/stringio/stringio.c | |
parent | 4af65e86a82037f09e44e0cad4743cdbec25c7af (diff) |
* ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended
part. [ruby-dev:25618]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio/stringio.c')
-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 7c1e4ba5f9..23ba3dce4d 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -950,10 +950,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; } |