From 8fc5ac7fd3db52b32facd4a1f6823aa287808233 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 7 Nov 2008 01:05:49 +0300 Subject: [PATCH] Fixed crash at using .account set gmlevel with wrong args. --- src/game/Level3.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index fd8d3f117..27bf3bc02 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -682,6 +682,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) if( !arg1 ) return false; + /// must be NULL if targeted syntax and must be not nULL if not targeted char* arg2 = strtok(NULL, " "); std::string targetAccountName; @@ -696,6 +697,9 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) if(arg2) return false; + /// security level expected in arg2 after this if. + arg2 = arg1; + targetAccountId = targetPlayer->GetSession()->GetAccountId(); targetSecurity = targetPlayer->GetSession()->GetSecurity(); if(!accmgr.GetName(targetAccountId,targetAccountName)) @@ -707,6 +711,10 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) } else { + /// wrong command syntax (second arg expected) + if(!arg2) + return false; + targetAccountName = arg1; if(!AccountMgr::normilizeString(targetAccountName)) {