From 03e5f5cc9965b7e33a7b4b60a7ac300373423f0b Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Mon, 13 May 2013 15:49:39 +0000
Subject: [PATCH] No, the well-named strlen variable does not include the NULL
 terminator Mr. Smarty Pants.

---
 src/sbbs3/js_global.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sbbs3/js_global.c b/src/sbbs3/js_global.c
index f1d11ae9ca..b03a955a2d 100644
--- a/src/sbbs3/js_global.c
+++ b/src/sbbs3/js_global.c
@@ -2468,7 +2468,7 @@ js_internal_charfunc(JSContext *cx, uintN argc, jsval *arglist, char *(*func)(ch
 	if(str==NULL) 
 		return(JS_TRUE);
 	if(extra_bytes) {
-		rastr=realloc(str, strlen+extra_bytes);
+		rastr=realloc(str, strlen+extra_bytes+1 /* for terminator */);
 		if(rastr==NULL)
 			return JS_TRUE;
 	}
-- 
GitLab