*Attempt to fix a crash, and sanitize some input.
--HG-- branch : trunk
This commit is contained in:
+1
-1
@@ -244,7 +244,7 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args)
|
|||||||
uint32 account_id = m_session->GetAccountId();
|
uint32 account_id = m_session->GetAccountId();
|
||||||
|
|
||||||
int lev=atoi(szExp); //get int anyway (0 if error)
|
int lev=atoi(szExp); //get int anyway (0 if error)
|
||||||
if(lev < 0)
|
if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// No SQL injection
|
// No SQL injection
|
||||||
|
|||||||
+1
-1
@@ -6998,7 +6998,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
int lev=atoi(szExp); //get int anyway (0 if error)
|
int lev=atoi(szExp); //get int anyway (0 if error)
|
||||||
if(lev < 0)
|
if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// No SQL injection
|
// No SQL injection
|
||||||
|
|||||||
+2
-2
@@ -11356,9 +11356,9 @@ Unit* Creature::SelectVictim()
|
|||||||
// Note: creature not have targeted movement generator but have attacker in this case
|
// Note: creature not have targeted movement generator but have attacker in this case
|
||||||
for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
|
for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
|
||||||
{
|
{
|
||||||
if(canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
|
if((*itr) && canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
|
||||||
&& !((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)
|
&& !((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)
|
||||||
&& (!(*itr)->getVictim() || !(*itr)->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly
|
&& (!(*itr)->getVictim() || !(*itr)->isAttackingPlayer() || IsFriendlyTo((*itr)->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user