diff --git a/ruamoko/qwaq/qwaq-editbuffer-bi.c b/ruamoko/qwaq/qwaq-editbuffer-bi.c index ef870e4a0..1beb6eabd 100644 --- a/ruamoko/qwaq/qwaq-editbuffer-bi.c +++ b/ruamoko/qwaq/qwaq-editbuffer-bi.c @@ -456,6 +456,8 @@ formatLine (txtbuffer_t *buffer, unsigned linePtr, unsigned xpos, int col; byte c = 0; int count; + int *startdst = dst; + int startlen = length; while (pos < xpos && ptr < buffer->textSize) { c = getChar (buffer, ptr); @@ -498,6 +500,10 @@ formatLine (txtbuffer_t *buffer, unsigned linePtr, unsigned xpos, while (length-- > 0) { *dst++ = col | ' '; } + if (dst - startdst > startlen) { + Sys_Error ("formatLine wrote too much: %zd %u %d", + dst - startdst, startlen, length); + } return ptr; }