From f6f10a728bce3638847e5c77a78e81809e3c454c Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Wed, 18 Mar 2015 18:49:38 +0100 Subject: fix the potential use of uninitialized memory in Svcmd_LayoutSave_f() --- src/game/g_svcmds.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/game') diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index 72d26478..ae67e291 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -222,19 +222,18 @@ static void Svcmd_LayoutSave_f( void ) while( *s && i < sizeof( str2 ) - 1 ) { if( isalnum( *s ) || *s == '-' || *s == '_' ) - { str2[ i++ ] = *s; - str2[ i ] = '\0'; - } s++; } - if( !str2[ 0 ] ) + if( i == 0 ) { G_Printf( "layoutsave: invalid name \"%s\"\n", str ); return; } + str2[ i ] = '\0'; + G_LayoutSave( str2 ); } -- cgit