From 16ee65422d4852df1e1bf70124bf7cbaa653a283 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 22 Jul 2012 20:30:02 +0200 Subject: [PATCH] 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. --- src/util/cbuffer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/cbuffer.c b/src/util/cbuffer.c index a0ac239..3075011 100644 --- a/src/util/cbuffer.c +++ b/src/util/cbuffer.c @@ -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; }