summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-09-17 00:28:18 +0200
committerRichard Braun <rbraun@sceen.net>2018-09-17 00:28:18 +0200
commit562033bdc83fcd0ceff958faf1ce070ca1c48eec (patch)
treedfb74ebae2442040e135d16f11f8f39754d2616d /src
parentb7bb9e691d29f31d35fe866068ba3cf16e2ef338 (diff)
cbuf: fix invalid overflow check
This change fixes a check that would incorrectly consider a size of 0 as an overflow.
Diffstat (limited to 'src')
-rw-r--r--src/cbuf.c2
1 files changed, 1 insertions, 1 deletions
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;