diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2010-03-29 16:33:13 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:32 +0000 |
commit | 55004fcab9cc37836ef376f2277de73b553bb982 (patch) | |
tree | 4908964fba38bf4d79c9edc802ef18efe50f6ac4 | |
parent | 31922eb1d2b923221401e5b7d06775f2899f5055 (diff) |
* Fix handling of invalid userinfo
-rw-r--r-- | src/game/g_client.c | 11 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_namelog.c | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c index 3bbdb754..0cdd7d0b 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -971,7 +971,7 @@ The game can override any of the settings and call trap_SetUserinfo if desired. ============ */ -void ClientUserinfoChanged( int clientNum ) +char *ClientUserinfoChanged( int clientNum ) { gentity_t *ent; char *s; @@ -997,6 +997,7 @@ void ClientUserinfoChanged( int clientNum ) "disconnect \"illegal or malformed userinfo\n\"" ); trap_DropClient( ent - g_entities, "dropped: illegal or malformed userinfo"); + return "Illegal or malformed userinfo"; } // stickyspec toggle @@ -1160,6 +1161,8 @@ void ClientUserinfoChanged( int clientNum ) trap_SetConfigstring( CS_PLAYERS + clientNum, userinfo ); /*G_LogPrintf( "ClientUserinfoChanged: %i %s\n", clientNum, userinfo );*/ + + return NULL; } @@ -1186,6 +1189,7 @@ restarts. char *ClientConnect( int clientNum, qboolean firstTime ) { char *value; + char *userInfoError; gclient_t *client; char userinfo[ MAX_INFO_STRING ]; gentity_t *ent; @@ -1256,7 +1260,10 @@ char *ClientConnect( int clientNum, qboolean firstTime ) // get and distribute relevent paramters G_namelog_connect( client ); - ClientUserinfoChanged( clientNum ); + userInfoError = ClientUserinfoChanged( clientNum ); + if( userInfoError != NULL ) + return userInfoError; + G_LogPrintf( "ClientConnect: %i [%s] (%s) \"%s^7\" \"%c%s%c^7\"\n", clientNum, client->pers.ip.str, client->pers.guid, client->pers.netname, diff --git a/src/game/g_local.h b/src/game/g_local.h index 9ee9e043..147a43c4 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -958,7 +958,7 @@ int G_TimeTilSuddenDeath( void ); // g_client.c // char *ClientConnect( int clientNum, qboolean firstTime ); -void ClientUserinfoChanged( int clientNum ); +char *ClientUserinfoChanged( int clientNum ); void ClientDisconnect( int clientNum ); void ClientBegin( int clientNum ); void ClientCommand( int clientNum ); diff --git a/src/game/g_namelog.c b/src/game/g_namelog.c index 53a3f5de..dfd8c712 100644 --- a/src/game/g_namelog.c +++ b/src/game/g_namelog.c @@ -70,6 +70,8 @@ void G_namelog_connect( gclient_t *client ) void G_namelog_disconnect( gclient_t *client ) { + if( client->pers.namelog == NULL ) + return; client->pers.namelog->slot = -1; client->pers.namelog = NULL; } |