Topic: Security hole in server
Someone was exploiting a security hole in the server I was playing on and making it crash and restart tonight. The bug is here in gs_server.cpp:
if(msg == MSG_CHANGEINFO && strcmp(name, server_clientname(client_id)) != 0)
{
char msg[256];
sprintf(msg, "*** %s changed name to %s", server_clientname(client_id), name);
send_chat(-1, -1, msg);
}
The evildoer was presumably sending handcrafted messages with names larger than 256 characters. Looks nasty...
this should be snprintf or you should check strlen(name) first.
I'm not certain, but I'm not convinced there aren't other bugs like this lurking in the message unpacking code. This is kind of dangerous because it could give someone shell access to any machine running a server...