Fix for a potential buffer overflow on login server under very rare circumstances via Rogean. Fix for perl parser not clearing errors via sorvani

This commit is contained in:
KimLS 2014-01-03 23:41:11 -08:00
parent a9b4e7819f
commit c725ee84bb
2 changed files with 8 additions and 1 deletions

View File

@ -201,6 +201,13 @@ bool WorldServer::Process()
} }
case ServerOP_LSAccountUpdate: case ServerOP_LSAccountUpdate:
{ {
if(app->size < sizeof(ServerLSAccountUpdate_Struct))
{
server_log->Log(log_network_error, "Recieved application packet from server that had opcode ServerLSAccountUpdate_Struct, "
"but was too small. Discarded to avoid buffer overrun.");
break;
}
server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate packet received from: %s", short_name.c_str()); server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate packet received from: %s", short_name.c_str());
ServerLSAccountUpdate_Struct *lsau = (ServerLSAccountUpdate_Struct*)app->pBuffer; ServerLSAccountUpdate_Struct *lsau = (ServerLSAccountUpdate_Struct*)app->pBuffer;
if(trusted) if(trusted)

View File

@ -126,7 +126,6 @@ PerlembParser::~PerlembParser() {
} }
void PerlembParser::ReloadQuests() { void PerlembParser::ReloadQuests() {
try { try {
if(perl == nullptr) { if(perl == nullptr) {
perl = new Embperl; perl = new Embperl;
@ -145,6 +144,7 @@ void PerlembParser::ReloadQuests() {
throw e.what(); throw e.what();
} }
errors_.clear();
npc_quest_status_.clear(); npc_quest_status_.clear();
global_npc_quest_status_ = questUnloaded; global_npc_quest_status_ = questUnloaded;
player_quest_status_ = questUnloaded; player_quest_status_ = questUnloaded;