summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index efd77320..66622407 100644
--- a/lib.c
+++ b/lib.c
@@ -761,8 +761,10 @@ val mkstring(val len, val ch)
val mkustring(val len)
{
- wchar_t *str = (wchar_t *) chk_malloc((c_num(len) + 1) * sizeof *str);
+ cnum l = c_num(len);
+ wchar_t *str = (wchar_t *) chk_malloc((l + 1) * sizeof *str);
val s = string_own(str);
+ str[l] = 0;
s->st.len = len;
return s;
}