Fix cbuffer initialization
If no data was appended, cbuf_get() would return a pointer to uninitialized memory. Now it returns a pointer to a string of zero length.
This commit is contained in:
parent
f0b11dadf1
commit
16ee65422d
@ -36,6 +36,7 @@ extern struct cbuffer* cbuf_create(size_t capacity)
|
||||
buf->size = 0;
|
||||
buf->flags = 0;
|
||||
buf->buf = hub_malloc(capacity + 1);
|
||||
buf->buf[0] = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user