summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/string.c b/string.c
index 78620b8048..29e84e3ffe 100644
--- a/string.c
+++ b/string.c
@@ -1667,6 +1667,7 @@ rb_str_unlocktmp(VALUE str)
void
rb_str_set_len(VALUE str, long len)
{
+ rb_str_modify(str);
STR_SET_LEN(str, len);
RSTRING_PTR(str)[len] = '\0';
}