魔兽世界私服| 新开魔兽私服文章 | 历史已开私服 | 私服家族联盟 | 私服游戏攻略 | 魔兽相关下载 | 最新版本研究 | 家族发布 | 魔兽经验交流 | 各大魔兽家族排行榜
  当前位置:返回首页>>返回私服文章首页>>技术文章内容
[最新版本研究]解决Antrix Ascent被人攻击出现RunTimeError的bug
魔兽私服网   发布时间:2008-4-30 16:30:34
Index: src/game/AddonMgr.cpp

===================================================================

--- src/game/AddonMgr.cpp    (revision 988)

+++ src/game/AddonMgr.cpp    (working copy)

@@ -108,15 +108,18 @@


    uint32 realsize;
    uLongf rsize;
-    try
+    if (source->size() < 4)
    {
-        *source >> realsize;
+        sLog.outDebug("Warning: Incomplete auth session sent.");
+        return;
    }
-    catch (*yte*uffer::error &)
+    *source >> realsize;
+    if (realsize > 5000)// i'm not sure what is the max size!! ,just set it 5000

    {
-        sLog.outDebug("Warning: Incomplete auth session sent.");
+        sLog.outError("Warning: Incorrect realsize = %d", realsize);
        return;
-    }   
+    }
+
    rsize = realsize;
    uint32 position = source->rpos();

@@ -130,6 +133,7 @@

        return;
    }
    int32 result;
+    sLog.outDebug("AddonMgr::SendAddonInfoPacket: realsize = %d, source.size = %d, needsize(position + 5) = %d.",realsize,source->size(),(position + 5));
    result = uncompress((uint8*)unpacked.contents(), &rsize, (uint8*)(*source).contents() + position, (*source).size() - position);

    if(result != Z_OK)
Index: src/game/MiscHandler.cpp

===================================================================

--- src/game/MiscHandler.cpp    (revision 988)

+++ src/game/MiscHandler.cpp    (working copy)

@@ -942,6 +942,8 @@

    sLog.outDetail("WORLD: Received CMSG_REQUEST_ACCOUNT_DATA");

    uint32 id;
+    if (recv_data.size() < 4)
+        return;
    recv_data >> id;
   
    if(id > 8)
Index: src/game/WorldSocket.cpp

===================================================================

--- src/game/WorldSocket.cpp    (revision 988)

+++ src/game/WorldSocket.cpp    (working copy)

@@ -115,17 +115,19 @@

    std::string account;
    uint32 unk2;
    _latency = getMSTime() - _latency;
+    if (recvPacket->size() < 4+4+1+4+20)
+    {
+        sLog.outDebug("Incomplete copy of AUTH_SESSION recieved, recvPacket.size=%d(need>=33).", recvPacket->size());
+        return;
+    }

-    try
-    {
        *recvPacket >> mClient*uild;
        *recvPacket >> unk2;
        *recvPacket >> account;
        *recvPacket >> mClientSeed;
-    }
-    catch(*yte*uffer::error &)
+    if (recvPacket->size() < 4+4+(account.size()+1)+4+20)
    {
-        sLog.outDetail("Incomplete copy of AUTH_SESSION recieved.");
+        sLog.outDebug("Recheck size incorrect,incomplete copy of AUTH_SESSION recieved, recvPacket.size=%d(need>=%d).", recvPacket->size(),(4+4+(account.size()+1)+4+20) );
        return;
    }

@@ -162,8 +164,19 @@

    uint32 AccountID;
    string GMFlags;
    uint32 AccountFlags;
-   
+    if (recvData.size() < 4+4+1+1+40)
+    {
+        sLog.outDebug("WorldSocket::InformationRetreiveCallback - Incorrect size of recvData recieved, recvData.size=%d(need>=50).", recvData.size());
+        return;
+    }
+
    recvData >> AccountID >> AccountName >> GMFlags >> AccountFlags;
+    if (recvData.size() < 4+4+(AccountName.size()+1)+(GMFlags.size()+1)+40)
+    {
+        sLog.outDebug("WorldSocket::InformationRetreiveCallback - Recheck size incorrect, recvData.size=%d(need>=%d).", recvData.size(),(4+4+(AccountName.size()+1)+(GMFlags.size()+1)+40) );
+        return;
+    }
+
    sLog.outDebug( " >> got information packet from logon: `%s` ID %u (request %u)", AccountName.c_str(), AccountID, mRequestID);
//    sLog.outColor(TNORMAL, "\n");

Index: src/logonserver/LogonCommServer.cpp

===================================================================

--- src/logonserver/LogonCommServer.cpp    (revision 988)

+++ src/logonserver/LogonCommServer.cpp    (working copy)

@@ -275,7 +275,11 @@

{
    /* this packet is gzipped, whee! */
    uint32 real_size;
+    if (recvData.size() < 4)
+        return;
    recvData >> real_size;
+    if (real_size > 5000) // i'm not sure what is the max size!! ,just set it 5000
+        return;
    uLongf rsize = real_size;

    *yte*uffer buf(real_size);
上一篇魔兽私服文章:上一篇: 最全的世界副本传送坐标(副本外)
下一篇魔兽私服文章:下一篇: Antix增加声望命令及各声望对应I

Copyright 2008-2009 www.haoztw.Com All Rights Reserved(注:本站只投放九城官方授权魔兽世界私服)
品牌商标、文字、形象及内容归魔兽世界私服版权所有 任何组织或个人未经同意,不得使用和传播 网站备案登记号:渝ICP备02394311号
拒绝盗版魔兽世界私服游戏 注意自我保护 谨防受骗上当 适度游戏益脑 沉迷游戏伤身 合理安排时间 享受健康生活
*注释:本站所有魔兽私服游戏信息,均来自互联网,与本站无关。请玩家仔细辨认魔兽私服游戏信息的真实性,避免上当受骗!