mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[6842] More correct guid/name arg processing in .pdump write command, reject early wrong player name in HandleWhoisOpcode.
This commit is contained in:
parent
809bd7392f
commit
2da935ecc4
4 changed files with 29 additions and 7 deletions
|
|
@ -5590,9 +5590,23 @@ bool ChatHandler::HandleWritePDumpCommand(const char *args)
|
||||||
if(!file || !p2)
|
if(!file || !p2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 guid = objmgr.GetPlayerGUIDByName(p2);
|
uint32 guid;
|
||||||
if(!guid)
|
// character name can't start from number
|
||||||
|
if (isNumeric(p2[0])
|
||||||
guid = atoi(p2);
|
guid = atoi(p2);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string name = p2;
|
||||||
|
|
||||||
|
if (!normalizePlayerName (name))
|
||||||
|
{
|
||||||
|
SendSysMessage (LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage (true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
guid = objmgr.GetPlayerGUIDByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
if(!objmgr.GetPlayerAccountIdByGUID(guid))
|
if(!objmgr.GetPlayerAccountIdByGUID(guid))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1255,14 +1255,12 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(charname.empty())
|
if(charname.empty() || !normalizePlayerName (charname))
|
||||||
{
|
{
|
||||||
SendNotification(LANG_NEED_CHARACTER_NAME);
|
SendNotification(LANG_NEED_CHARACTER_NAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
normalizePlayerName (charname);
|
|
||||||
|
|
||||||
Player *plr = objmgr.GetPlayer(charname.c_str());
|
Player *plr = objmgr.GetPlayer(charname.c_str());
|
||||||
|
|
||||||
if(!plr)
|
if(!plr)
|
||||||
|
|
|
||||||
|
|
@ -170,9 +170,19 @@ inline bool isEastAsianCharacter(wchar_t wchar)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool isNumeric(wchar_t wchar)
|
||||||
|
{
|
||||||
|
return (wchar >= L'0' && wchar <=L'9');
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isNumeric(char c)
|
||||||
|
{
|
||||||
|
return (c >= '0' && c <='9');
|
||||||
|
}
|
||||||
|
|
||||||
inline bool isNumericOrSpace(wchar_t wchar)
|
inline bool isNumericOrSpace(wchar_t wchar)
|
||||||
{
|
{
|
||||||
return (wchar >= L'0' && wchar <=L'9') || wchar == L' ';
|
return isNumeric(wchar) || wchar == L' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
|
inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6841"
|
#define REVISION_NR "6842"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue