Skip to content
Snippets Groups Projects
Commit d0b17576 authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

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.
parent 1c9496e0
No related branches found
No related tags found
No related merge requests found
...@@ -180,7 +180,7 @@ static inline void postString(EventsBuf *eb, const char *buf) ...@@ -180,7 +180,7 @@ static inline void postString(EventsBuf *eb, const char *buf)
{ {
if (buf) { if (buf) {
const int len = strlen(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); memcpy(eb->pos, buf, len);
eb->pos += len; eb->pos += len;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment