Core/Warden: Fix for LUA_STR_CHECK (#25247)

The check above is what I use to actually get a real result for LUA_STR_CHECK, which when I used variables that would have a string to them it actually fails the check. When checking for items like a function if it exists of course it won't work... In addition, fixing the Unk2 to Unk3 causes people to be able to adjust the address of the check to the address 0x00419210 to make warden perform the FrameScript__Execute to run lua on the client. This seems to be the big request like in https://github.com/TrinityCore/TrinityCore/issues/23035
This commit is contained in:
scizzydo
2020-08-16 05:50:08 -07:00
committed by GitHub
parent 5e40eb20e2
commit 4125a81bb1

View File

@@ -105,7 +105,7 @@ void WardenWin::InitializeModule()
Request.String_library2 = 0;
Request.Function2 = 0x00419D40; // 0x00400000 + 0x00419D40 FrameScript::GetText
Request.Function2_set = 1;
Request.CheckSumm2 = BuildChecksum(&Request.Unk2, 8);
Request.CheckSumm2 = BuildChecksum(&Request.Unk3, 8);
Request.Command3 = WARDEN_SMSG_MODULE_INITIALIZE;
Request.Size3 = 8;
@@ -420,18 +420,17 @@ void WardenWin::HandleCheckResult(ByteBuffer &buff)
if (Lua_Result != 0)
{
TC_LOG_DEBUG("warden", "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", id, _session->GetAccountId());
checkFailed = id;
continue;
}
uint8 luaStrLen = buff.read<uint8>();
if (luaStrLen != 0)
{
std::string str;
str.resize(luaStrLen);
buff.read(reinterpret_cast<uint8*>(str.data()), luaStrLen);
TC_LOG_DEBUG("warden", "Lua string: %s", str.c_str());
uint8 luaStrLen = buff.read<uint8>();
if (luaStrLen != 0)
{
std::string str;
str.resize(luaStrLen);
buff.read(reinterpret_cast<uint8*>(str.data()), luaStrLen);
TC_LOG_DEBUG("warden", "Lua string: %s", str.c_str());
TC_LOG_DEBUG("warden", "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", id, _session->GetAccountId());
checkFailed = id;
continue;
}
}
TC_LOG_DEBUG("warden", "RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", id, _session->GetAccountId());
break;