diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-05 05:45:40 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-05 05:45:40 +0000 |
| commit | d547985d5b0e960af0299d9a5b12d4e008f90631 (patch) | |
| tree | 553f999443bed1b327401db5520113b63993fd3f /string.c | |
| parent | c625f7902998cf60c098f3ea281c6c48bd4b99c8 (diff) | |
| download | ruby-d547985d5b0e960af0299d9a5b12d4e008f90631.tar.gz ruby-d547985d5b0e960af0299d9a5b12d4e008f90631.tar.xz ruby-d547985d5b0e960af0299d9a5b12d4e008f90631.zip | |
* string.c (rb_str_resize): copy at old length but not new length.
[ruby-core:14785]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -948,7 +948,7 @@ rb_str_resize(VALUE str, long len) else if (len <= RSTRING_EMBED_LEN_MAX) { char *ptr = RSTRING(str)->as.heap.ptr; STR_SET_EMBED(str); - MEMCPY(RSTRING(str)->as.ary, ptr, char, len); + if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen); RSTRING(str)->as.ary[len] = '\0'; STR_SET_EMBED_LEN(str, len); xfree(ptr); |
