summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-04 11:08:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-04 11:08:28 +0000
commit5f13d888cf0aece7c1bb13b72773f66a4b9cebff (patch)
tree3f6f83022e0f7d352507d7691964d2d47d0bf3f3 /string.c
parent36044b07730033911580501cbe1a060e820e927e (diff)
* string.c (rb_str_resize): reverted r28851. rb_str_resize cannot
work before the length is set. [ruby-core:31615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index decc9d7f049..9fe344a20fe 100644
--- a/string.c
+++ b/string.c
@@ -1723,7 +1723,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);
- if (len > 0) 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);
if (independent) xfree(ptr);