summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2015-03-18 18:49:38 +0100
committer/dev/humancontroller <devhc@example.com>2017-02-08 02:17:00 +0100
commitf6f10a728bce3638847e5c77a78e81809e3c454c (patch)
treec6c22222bc5c98ba51492cf67a06a96fd3ec8176 /src
parentc6e1f74826a6579553944771f487ca6beb4257f4 (diff)
fix the potential use of uninitialized memory in Svcmd_LayoutSave_f()
Diffstat (limited to 'src')
-rw-r--r--src/game/g_svcmds.c7
1 files changed, 3 insertions, 4 deletions
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 );
}