summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index 2004c9fe8..88dcfc63e 100644
--- a/src/string.c
+++ b/src/string.c
@@ -62,6 +62,7 @@ mrb_str_modify(mrb_state *mrb, struct RString *s)
if (shared->refcnt == 1 && s->ptr == shared->ptr) {
s->ptr = shared->ptr;
s->aux.capa = shared->len;
+ s->ptr[s->len] = '\0';
mrb_free(mrb, shared);
}
else {