added sanity checks

This commit is contained in:
CPunch 2020-08-20 18:50:30 -05:00
parent da11220762
commit 7b085e9c8b
3 changed files with 8 additions and 1 deletions

View File

@ -29,6 +29,7 @@ enum SHARDPACKETID {
P_FE2CL_REP_NANO_ACTIVE_SUCC = 822083624, P_FE2CL_REP_NANO_ACTIVE_SUCC = 822083624,
P_FE2CL_REP_PC_ENTER_SUCC = 822083586, P_FE2CL_REP_PC_ENTER_SUCC = 822083586,
P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC = 822083833, P_FE2CL_REP_PC_LOADING_COMPLETE_SUCC = 822083833,
P_FE2CL_REP_PC_GOTO_SUCC = 822083633,
P_FE2CL_REQ_LIVE_CHECK = 822083792, P_FE2CL_REQ_LIVE_CHECK = 822083792,
P_FE2CL_PC_NEW = 822083587, P_FE2CL_PC_NEW = 822083587,
P_FE2CL_PC_MOVE = 822083592, P_FE2CL_PC_MOVE = 822083592,
@ -42,7 +43,7 @@ enum SHARDPACKETID {
P_FE2CL_PC_SLOPE = 822083705, P_FE2CL_PC_SLOPE = 822083705,
P_FE2CL_NPC_ENTER = 822083595, P_FE2CL_NPC_ENTER = 822083595,
P_FE2CL_NPC_EXIT = 822083596, P_FE2CL_NPC_EXIT = 822083596,
P_FE2CL_REP_PC_GOTO_SUCC = 822083633, P_FE2CL_ANNOUNCE_MSG = 822083778,
P_FE2CL_GM_REP_PC_SET_VALUE = 822083781, P_FE2CL_GM_REP_PC_SET_VALUE = 822083781,
P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC = 822083602, P_FE2CL_REP_SEND_FREECHAT_MESSAGE_SUCC = 822083602,
P_FE2CL_REP_PC_AVATAR_EMOTES_CHAT = 822083730, P_FE2CL_REP_PC_AVATAR_EMOTES_CHAT = 822083730,

View File

@ -9,6 +9,9 @@ void ChatManager::init() {
} }
void ChatManager::chatHandler(CNSocket* sock, CNPacketData* data) { void ChatManager::chatHandler(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_SEND_FREECHAT_MESSAGE))
return; // malformed packet
sP_CL2FE_REQ_SEND_FREECHAT_MESSAGE* chat = (sP_CL2FE_REQ_SEND_FREECHAT_MESSAGE*)data->buf; sP_CL2FE_REQ_SEND_FREECHAT_MESSAGE* chat = (sP_CL2FE_REQ_SEND_FREECHAT_MESSAGE*)data->buf;
PlayerView plr = PlayerManager::players[sock]; PlayerView plr = PlayerManager::players[sock];

View File

@ -8,6 +8,9 @@ void NanoManager::init() {
} }
void NanoManager::nanoSummonHandler(CNSocket* sock, CNPacketData* data) { void NanoManager::nanoSummonHandler(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_NANO_ACTIVE))
return; // malformed packet
sP_CL2FE_REQ_NANO_ACTIVE* nano = (sP_CL2FE_REQ_NANO_ACTIVE*)data->buf; sP_CL2FE_REQ_NANO_ACTIVE* nano = (sP_CL2FE_REQ_NANO_ACTIVE*)data->buf;
PlayerView plr = PlayerManager::players[sock]; PlayerView plr = PlayerManager::players[sock];