]> git.meshlink.io Git - utcp/blobdiff - utcp.c
Handle the case where we reduce the buffer size below the amount currently used.
[utcp] / utcp.c
diff --git a/utcp.c b/utcp.c
index 75d4f83417a3be30bccc6346757abef8f7643585..6279d925a781814eeb06710c406fa47063c2f052 100644 (file)
--- 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.