kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 0b368777369276853d534aef49066eed871f84f7
parent 7b9b1d5c2c467656b41372c7094b25115e1ef01f
Author: Joris Vink <joris@coders.se>
Date:   Mon,  4 Aug 2014 18:59:59 +0200

Change kore_buf_appendv() to use vasprintf().

Diffstat:
src/buf.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/buf.c b/src/buf.c @@ -56,13 +56,14 @@ void kore_buf_appendv(struct kore_buf *buf, const char *fmt, va_list args) { int l; - char b[4096]; + char *b; - l = vsnprintf(b, sizeof(b), fmt, args); - if (l == -1 || (size_t)l >= sizeof(b)) + l = vasprintf(&b, fmt, args); + if (l == -1) fatal("kore_buf_appendv(): error or truncation"); kore_buf_append(buf, (u_int8_t *)b, l); + free(b); } void