[refactor] Validate all inbound packets before handling them

This commit is contained in:
2021-03-19 02:32:07 +01:00
parent 7c7d9f1be8
commit ef7d0148c6
8 changed files with 321 additions and 231 deletions

View File

@@ -17,7 +17,7 @@ CNLoginServer::CNLoginServer(uint16_t p) {
}
void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) {
printPacket(data, CL2LS);
printPacket(data);
switch (data->type) {
case P_CL2LS_REQ_LOGIN: {
@@ -62,7 +62,7 @@ void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) {
}
default:
if (settings::VERBOSITY)
std::cerr << "OpenFusion: LOGIN UNIMPLM ERR. PacketType: " << Packets::p2str(CL2LS, data->type) << " (" << data->type << ")" << std::endl;
std::cerr << "OpenFusion: LOGIN UNIMPLM ERR. PacketType: " << Packets::p2str(data->type) << " (" << data->type << ")" << std::endl;
break;
/*
* Unimplemented CL2LS packets: