summaryrefslogtreecommitdiff
path: root/kern/cbuf.h
diff options
context:
space:
mode:
Diffstat (limited to 'kern/cbuf.h')
-rw-r--r--kern/cbuf.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/kern/cbuf.h b/kern/cbuf.h
index a30e5f28..4d69334d 100644
--- a/kern/cbuf.h
+++ b/kern/cbuf.h
@@ -70,7 +70,9 @@ cbuf_clear(struct cbuf *cbuf)
static inline bool
cbuf_range_valid(const struct cbuf *cbuf, size_t start, size_t end)
{
- return ((end - start) <= cbuf_size(cbuf));
+ return (((end - start) <= cbuf_size(cbuf))
+ && ((start - cbuf->start) <= cbuf_size(cbuf))
+ && ((cbuf->end - end) <= cbuf_size(cbuf)));
}
/*