summaryrefslogtreecommitdiffstatshomepage
path: root/py/vstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/vstr.c')
-rw-r--r--py/vstr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/vstr.c b/py/vstr.c
index ba85fa43c7..3367ae581d 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -52,9 +52,10 @@ void vstr_init(vstr_t *vstr, size_t alloc) {
vstr->fixed_buf = false;
}
-// Init the vstr so it allocs exactly enough ram to hold given length, and set the length.
+// Init the vstr so it allocs exactly enough ram to hold a null-terminated
+// string of the given length, and set the length.
void vstr_init_len(vstr_t *vstr, size_t len) {
- vstr_init(vstr, len);
+ vstr_init(vstr, len + 1);
vstr->len = len;
}