check for overflows in SV_SetConfigstring and print a warning message when the gs buffer overflows

This commit is contained in:
myT 2017-05-23 23:46:52 +02:00
parent 1bd7614d21
commit b51ac6eb9a
2 changed files with 8 additions and 0 deletions

View File

@ -630,6 +630,10 @@ static void SV_SendClientGameState( client_t* client )
MSG_WriteLong( &msg, sv.checksumFeed );
if ( msg.overflowed ) {
Com_Printf( "ERROR: gamestate message buffer overflow\n" );
}
SV_SendMessageToClient( &msg, client );
}

View File

@ -42,6 +42,10 @@ void SV_SetConfigstring (int index, const char *val) {
val = "";
}
if ( strlen(val) >= BIG_INFO_STRING ) {
Com_Error( ERR_DROP, "SV_SetConfigstring: CS %d is too long\n", index );
}
// don't bother broadcasting an update if no change
if ( !strcmp( val, sv.configstrings[ index ] ) ) {
return;