From 9fe3be0ad54dd1e0c8766957ea402d555d947839 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 12 Apr 2020 00:38:54 +0200 Subject: [PATCH] Handle the case where we reduce the buffer size below the amount currently used. --- utcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utcp.c b/utcp.c index 75d4f83..6279d92 100644 --- a/utcp.c +++ b/utcp.c @@ -401,7 +401,7 @@ static void buffer_exit(struct buffer *buf) { } static uint32_t buffer_free(const struct buffer *buf) { - return buf->maxsize - buf->used; + return buf->maxsize > buf->used ? buf->maxsize - buf->used : 0; } // Connections are stored in a sorted list. -- 2.39.5