mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[11863] Fix possible SQL injection for .tele add command. Close pull request #22
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
396ce3b71d
commit
ad5755f8ef
2 changed files with 12 additions and 7 deletions
|
|
@ -8062,22 +8062,27 @@ bool ObjectMgr::AddGameTele(GameTele& tele)
|
||||||
{
|
{
|
||||||
// find max id
|
// find max id
|
||||||
uint32 new_id = 0;
|
uint32 new_id = 0;
|
||||||
for(GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
|
for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr)
|
||||||
if(itr->first > new_id)
|
if (itr->first > new_id)
|
||||||
new_id = itr->first;
|
new_id = itr->first;
|
||||||
|
|
||||||
// use next
|
// use next
|
||||||
++new_id;
|
++new_id;
|
||||||
|
|
||||||
if(!Utf8toWStr(tele.name,tele.wnameLow))
|
if (!Utf8toWStr(tele.name, tele.wnameLow))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wstrToLower( tele.wnameLow );
|
wstrToLower(tele.wnameLow);
|
||||||
|
|
||||||
m_GameTeleMap[new_id] = tele;
|
m_GameTeleMap[new_id] = tele;
|
||||||
|
std::string safeName(tele.name);
|
||||||
|
WorldDatabase.escape_string(safeName);
|
||||||
|
|
||||||
return WorldDatabase.PExecuteLog("INSERT INTO game_tele (id,position_x,position_y,position_z,orientation,map,name) VALUES (%u,%f,%f,%f,%f,%u,'%s')",
|
return WorldDatabase.PExecuteLog("INSERT INTO game_tele "
|
||||||
new_id, tele.position_x, tele.position_y, tele.position_z, tele.orientation, tele.mapId, tele.name.c_str());
|
"(id,position_x,position_y,position_z,orientation,map,name) "
|
||||||
|
"VALUES (%u,%f,%f,%f,%f,%u,'%s')",
|
||||||
|
new_id, tele.position_x, tele.position_y, tele.position_z,
|
||||||
|
tele.orientation, tele.mapId, safeName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::DeleteGameTele(const std::string& name)
|
bool ObjectMgr::DeleteGameTele(const std::string& name)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11862"
|
#define REVISION_NR "11863"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue