From d0b17576148d336b67c7d65bcf742f83001413cb Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Wed, 15 Nov 2023 19:23:37 -0500
Subject: [PATCH] rts/eventlog: Fix off-by-one in assertion

Previously we failed to account for the NULL terminator `postString`
asserted that there is enough room in the buffer for the string.
---
 rts/eventlog/EventLog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index b052458b9e3a..bbb0279f81cd 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -180,7 +180,7 @@ static inline void postString(EventsBuf *eb, const char *buf)
 {
     if (buf) {
         const int len = strlen(buf);
-        ASSERT(eb->begin + eb->size > eb->pos + len);
+        ASSERT(eb->begin + eb->size > eb->pos + len + 1);
         memcpy(eb->pos, buf, len);
         eb->pos += len;
     }
-- 
GitLab