From 078d004dc272759154caf83ca9549c3a4c0cb5ee Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 25 May 2014 16:28:38 -0500 Subject: [PATCH] Fix potential buffer overflow in PS_ReadPrimitive Found by Coverity. --- code/botlib/l_script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/botlib/l_script.c b/code/botlib/l_script.c index cc74404a..766032ab 100644 --- a/code/botlib/l_script.c +++ b/code/botlib/l_script.c @@ -828,7 +828,7 @@ int PS_ReadPrimitive(script_t *script, token_t *token) len = 0; while(*script->script_p > ' ' && *script->script_p != ';') { - if (len >= MAX_TOKEN) + if (len >= MAX_TOKEN - 1) { ScriptError(script, "primitive token longer than MAX_TOKEN = %d", MAX_TOKEN); return 0;