diff options
author | maximius <none@none> | 2009-09-28 15:48:03 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-09-28 15:48:03 -0700 |
commit | 0a9addd224076f0a555535b6b08a342f61d056c8 (patch) | |
tree | cfbd874eac6e54c701152e9c67712797df07d7f8 | |
parent | daa9b62ec709bf741448dd375403f83cc11bc023 (diff) |
*Attempt to fix a crash, and sanitize some input.
--HG--
branch : trunk
-rw-r--r-- | src/game/Level0.cpp | 2 | ||||
-rw-r--r-- | src/game/Level3.cpp | 2 | ||||
-rw-r--r-- | src/game/Unit.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 95e35475cc1..3bdfaf1ba3d 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -244,7 +244,7 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args) uint32 account_id = m_session->GetAccountId(); int lev=atoi(szExp); //get int anyway (0 if error) - if(lev < 0) + if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION)) return false; // No SQL injection diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index c2e7857fcfe..8489b299d8f 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -6998,7 +6998,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args) return false; int lev=atoi(szExp); //get int anyway (0 if error) - if(lev < 0) + if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION)) return false; // No SQL injection diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a9faa5e72d8..1406a048b3a 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11356,9 +11356,9 @@ Unit* Creature::SelectVictim() // 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) { - if(canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER + if((*itr) && canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER && !((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; } |