summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index ff9ec00b..4f5cb11d 100644
--- a/lib.c
+++ b/lib.c
@@ -5285,13 +5285,14 @@ val mkstring(val len, val ch_in)
(uw_throwf(range_error_s, lit("~a: negative size ~s specified"),
self, len, nao), 0),
c_num(len, self));
- wchar_t *str = chk_wmalloc(l + 1);
+ size_t a = max(7, l);
+ wchar_t *str = chk_wmalloc(a + 1);
val s = string_own(str);
val ch = default_arg_strict(ch_in, chr(' '));
wmemset(str, c_chr(ch), l);
str[l] = 0;
s->st.len = len;
- s->st.alloc = c_num(len, self) + 1;
+ s->st.alloc = a;
return s;
}