From adca72d2a50b0a9695e1536dd8e6662070f20be1 Mon Sep 17 00:00:00 2001 From: "M. Kristall" Date: Sat, 3 Oct 2009 12:07:34 +0000 Subject: * Fix a buffer overflow introduced in revision 1121 * Admin parsing stuff: * Report the (theoretically) correct line number in parse error messages * Prevent an overflow in [command] section (levels) * Try to make the code flow a little better * !readconfig errors all get sent to console --- src/game/g_cmds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/game/g_cmds.c') diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 56617697..738239a7 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -3253,8 +3253,11 @@ qboolean G_SayArgv( int n, char *buffer, int bufferLength ) if( n > 0 ) return qfalse; //memccpy( buffer, s, ' ', bufferLength ); - while( bufferLength > 1 && *s && *s != ' ' ) + while( *s && *s != ' ' && bufferLength > 1 ) + { *buffer++ = *s++; + bufferLength--; + } *buffer = 0; return qtrue; } -- cgit