From 224fed759864e2d2db7e0745dbab7876be5da693 Mon Sep 17 00:00:00 2001 From: HarpyWar Date: Tue, 22 Sep 2015 18:40:01 +0300 Subject: [PATCH] restrict check for STARTGAME4 packet length for starcraft client only https://github.com/pvpgn/pvpgn-server/issues/159 --- src/bnetd/handle_bnet.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/bnetd/handle_bnet.cpp b/src/bnetd/handle_bnet.cpp index 71021d4..048d9c0 100644 --- a/src/bnetd/handle_bnet.cpp +++ b/src/bnetd/handle_bnet.cpp @@ -4046,13 +4046,17 @@ namespace pvpgn return -1; } - // Protection from hack attempt - // Large map name size will cause crash Starcraft client for user who select an item in game list ("Join" area) - // It occurs when the packet size of packet 0x0c in length interval 161-164 - if (packet_get_size(packet) > 160) + if (conn_get_clienttag(c) == CLIENTTAG_STARCRAFT_UINT || conn_get_clienttag(c) == CLIENTTAG_BROODWARS_UINT) { - eventlog(eventlog_level_error, __FUNCTION__, "[%d] got abnormal STARTGAME4 packet length (got %u bytes, hack attempt?)", conn_get_socket(c), packet_get_size(packet)); - return -1; + // FIXME: (HarpyWar) Protection from hack attempt + // Large map name size will cause crash Starcraft client for user who select an item in game list ("Join" area) + // It occurs when the packet size of packet 0x0c in length interval 161-164 + // https://github.com/pvpgn/pvpgn-server/issues/159 + if (packet_get_size(packet) > 160) + { + eventlog(eventlog_level_error, __FUNCTION__, "[%d] got abnormal STARTGAME4 packet length (got %u bytes, hack attempt?)", conn_get_socket(c), packet_get_size(packet)); + return -1; + } } // Quick hack to make W3 part channels when creating a game