From 562033bdc83fcd0ceff958faf1ce070ca1c48eec Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Mon, 17 Sep 2018 00:28:18 +0200 Subject: cbuf: fix invalid overflow check This change fixes a check that would incorrectly consider a size of 0 as an overflow. --- src/cbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cbuf.c b/src/cbuf.c index 20d505d..2baad37 100644 --- a/src/cbuf.c +++ b/src/cbuf.c @@ -164,7 +164,7 @@ cbuf_write(struct cbuf *cbuf, size_t index, const void *buf, size_t size) end = start + size; buf_end = cbuf->buf + cbuf->capacity; - if ((end <= cbuf->buf) || (end > buf_end)) { + if ((end < cbuf->buf) || (end > buf_end)) { skip = buf_end - start; memcpy(start, buf, skip); buf += skip; -- cgit v1.2.3