mirror of
https://github.com/minetest/minetest.git
synced 2024-12-25 07:32:24 +01:00
Deny empty username early in the protocol
Thanks to @UltimateNate for pointing this out :)
This commit is contained in:
parent
9facb40738
commit
e13d2bafc6
@ -164,9 +164,11 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
|||||||
*/
|
*/
|
||||||
const char* playername = playerName.c_str();
|
const char* playername = playerName.c_str();
|
||||||
|
|
||||||
if (playerName.size() > PLAYERNAME_SIZE) {
|
size_t pns = playerName.size();
|
||||||
actionstream << "Server: Player with an too long name "
|
if (pns == 0 || pns > PLAYERNAME_SIZE) {
|
||||||
<< "tried to connect from " << addr_s << std::endl;
|
actionstream << "Server: Player with "
|
||||||
|
<< ((pns > PLAYERNAME_SIZE) ? "a too long" : "an empty")
|
||||||
|
<< " name tried to connect from " << addr_s << std::endl;
|
||||||
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_WRONG_NAME);
|
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_WRONG_NAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user