summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 3dd2c536..d43107a1 100644
--- a/lib.c
+++ b/lib.c
@@ -3307,9 +3307,10 @@ val string_8bit(const unsigned char *str)
val string_8bit_size(const unsigned char *str, size_t sz)
{
size_t i;
- wchar_t *wstr = chk_wmalloc(sz);
+ wchar_t *wstr = chk_wmalloc(sz + 1);
for (i = 0; i < sz; i++)
wstr[i] = str[i];
+ wstr[i] = 0;
return string_own(wstr);
}