commit ed8110f10977160a247d9369f5b6be5ed9e49225
parent 0aae500e2f4f83509a8bf9bfad1799eb20a43d13
Author: Joris Vink <joris@coders.se>
Date: Sat, 9 Jan 2016 13:51:50 +0100
Paranoia about overflows.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/buf.c b/src/buf.c
@@ -32,6 +32,9 @@ kore_buf_create(u_int32_t initial)
void
kore_buf_append(struct kore_buf *buf, const void *d, u_int32_t len)
{
+ if ((buf->offset + len) < len)
+ fatal("overflow in kore_buf_append");
+
if ((buf->offset + len) > buf->length) {
buf->length += len + KORE_BUF_INCREMENT;
buf->data = kore_realloc(buf->data, buf->length);