summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
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 f5de52c152..5b1aefaac8 100644
--- a/string.c
+++ b/string.c
@@ -744,7 +744,7 @@ rb_str_cat(str, ptr, len)
}
if (FL_TEST(str, STR_ASSOC)) {
rb_str_modify(str);
- REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len+len);
+ REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len+len+1);
memcpy(RSTRING(str)->ptr + RSTRING(str)->len, ptr, len);
RSTRING(str)->len += len;
RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; /* sentinel */