summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-08-26 00:41:14 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-08-26 00:41:14 -0700
commit26839b9c248ce7cceae6281f235e3a6e505b82f7 (patch)
tree360f598c31cbd195d745862005b27797fdb7c09d /src/string.c
parentf3c8cf673556ad6420dbe4e21ee532b1a68b3301 (diff)
parent23df879a81161a0b87721f422ca7e68f63f6746e (diff)
downloadmruby-26839b9c248ce7cceae6281f235e3a6e505b82f7.tar.gz
mruby-26839b9c248ce7cceae6281f235e3a6e505b82f7.zip
Merge pull request #1487 from h2so5/z-option-with-shared-string
Fix a problem of 'z' option and shared string
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 {