1 parent 43e92cf commit 8cd72bdCopy full SHA for 8cd72bd
1 file changed
py/vstr.c
@@ -10,6 +10,10 @@
10
#define ROUND_ALLOC(a) (((a) & ((~0) - 7)) + 8)
11
12
void vstr_init(vstr_t *vstr, int alloc) {
13
+ if (alloc < 2) {
14
+ // need at least 1 byte for the null byte at the end
15
+ alloc = 2;
16
+ }
17
vstr->alloc = alloc;
18
vstr->len = 0;
19
vstr->buf = m_new(char, vstr->alloc);
0 commit comments