aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index bbd10e5..8223ada 100644
--- a/main.c
+++ b/main.c
@@ -20,8 +20,9 @@
sv_t sv_copy(sv_t old)
{
- char *newstr = calloc(1, old.size * sizeof(*newstr));
+ char *newstr = calloc(1, (old.size + 1) * sizeof(*newstr));
memcpy(newstr, old.data, old.size);
+ newstr[old.size] = '\0';
return SV(newstr, old.size);
}