From 305eedc238d6467c1c886ffb40748cb65731fff2 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 15 Mar 2006 03:04:33 +0000 Subject: [PATCH] Watch for overwriting the end of linebuf in word_wrap and munge the line in case of emergency. --- src/sbbs3/js_global.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sbbs3/js_global.c b/src/sbbs3/js_global.c index 45a272d0b4..d018078d4e 100644 --- a/src/sbbs3/js_global.c +++ b/src/sbbs3/js_global.c @@ -785,6 +785,11 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) old_prefix_bytes=prefix_bytes; } for(; inbuf[i]; i++) { + if(l>=len*2+2) { + l-=4; + linebuf[l]=0; + lprintf(LOG_CRIT, "Word wrap line buffer exceeded... munging line %s",linebuf); + } switch(inbuf[i]) { case '\r': crcount++; -- GitLab