Changeset - r17633:e67dd7cd38a4
[Not reviewed]
master
0 1 0
rubidium - 13 years ago 2011-05-03 15:05:15
rubidium@openttd.org
(svn r22414) -Fix [FS#4606]: kicking thyself via remote console crashes the server
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -495,7 +495,11 @@ static bool ConKickOrBan(const char *arg
 
	if (strchr(argv, '.') == NULL && strchr(argv, ':') == NULL) { // banning with ID
 
		ClientID client_id = (ClientID)atoi(argv);
 

	
 
		if (client_id == CLIENT_ID_SERVER) {
 
		/* Don't kill the server, or the client doing the rcon. The latter can't be kicked because
 
		 * kicking frees closes and subsequently free the connection related instances, which we
 
		 * would be reading from and writing to after returning. So we would read or write data
 
		 * from freed memory up till the segfault triggers. */
 
		if (client_id == CLIENT_ID_SERVER || client_id == _redirect_console_to_client) {
 
			IConsolePrintF(CC_ERROR, "ERROR: Silly boy, you can not %s yourself!", ban ? "ban" : "kick");
 
			return true;
 
		}
0 comments (0 inline, 0 general)