diff --git a/src/common/length.h b/src/common/length.h index 689d37b..82eca5d 100644 --- a/src/common/length.h +++ b/src/common/length.h @@ -19,6 +19,7 @@ enum EMisc SMS_MAX_LEN = 80, MOBILE_MAX_LEN = 32, SOCIAL_ID_MAX_LEN = 18, + MAP_ALLOW_MAX_LEN = 128, GUILD_NAME_MAX_LEN = 12, diff --git a/src/common/tables.h b/src/common/tables.h index 5fe2b64..e50b236 100644 --- a/src/common/tables.h +++ b/src/common/tables.h @@ -761,7 +761,7 @@ typedef struct SPacketGDSetup BYTE bChannel; // ä³Î WORD wListenPort; // Ŭ¶óÀ̾ðÆ®°¡ Á¢¼ÓÇÏ´Â Æ÷Æ® ¹øÈ£ WORD wP2PPort; // ¼­¹ö³¢¸® ¿¬°á ½ÃÅ°´Â P2P Æ÷Æ® ¹øÈ£ - LONG alMaps[32]; + LONG alMaps[MAP_ALLOW_MAX_LEN]; DWORD dwLoginCount; BYTE bAuthServer; } TPacketGDSetup; @@ -773,7 +773,7 @@ typedef struct SPacketDGMapLocations typedef struct SMapLocation { - LONG alMaps[32]; + LONG alMaps[MAP_ALLOW_MAX_LEN]; char szHost[MAX_HOST_LENGTH + 1]; WORD wPort; } TMapLocation; diff --git a/src/db/src/Peer.h b/src/db/src/Peer.h index acd743f..46e1a87 100644 --- a/src/db/src/Peer.h +++ b/src/db/src/Peer.h @@ -66,7 +66,7 @@ class CPeer : public CPeerBase DWORD m_dwUserCount; WORD m_wListenPort; // °ÔÀÓ¼­¹ö°¡ Ŭ¶óÀ̾ðÆ®¸¦ À§ÇØ listen ÇÏ´Â Æ÷Æ® WORD m_wP2PPort; // °ÔÀÓ¼­¹ö°¡ °ÔÀÓ¼­¹ö P2P Á¢¼ÓÀ» À§ÇØ listen ÇÏ´Â Æ÷Æ® - LONG m_alMaps[32]; // ¾î¶² ¸ÊÀ» °üÀåÇÏ°í Àִ°¡? + LONG m_alMaps[MAP_ALLOW_MAX_LEN]; // ¾î¶² ¸ÊÀ» °üÀåÇÏ°í Àִ°¡? TItemIDRangeTable m_itemRange; TItemIDRangeTable m_itemSpareRange; diff --git a/src/game/src/config.cpp b/src/game/src/config.cpp index cab2dc9..b278ec7 100644 --- a/src/game/src/config.cpp +++ b/src/game/src/config.cpp @@ -172,6 +172,12 @@ void map_allow_add(int index) exit(1); } + if (s_set_map_allows.size() >= MAP_ALLOW_MAX_LEN) + { + fprintf(stdout, "Fatal error: maximum allowed maps reached!\n"); + exit(1); + } + fprintf(stdout, "MAP ALLOW %d\n", index); s_set_map_allows.insert(index); } diff --git a/src/game/src/desc_client.cpp b/src/game/src/desc_client.cpp index dce9591..5c30653 100644 --- a/src/game/src/desc_client.cpp +++ b/src/game/src/desc_client.cpp @@ -180,7 +180,7 @@ void CLIENT_DESC::SetPhase(int iPhase) p.wListenPort = mother_port; p.wP2PPort = p2p_port; p.bAuthServer = false; - map_allow_copy(p.alMaps, 32); + map_allow_copy(p.alMaps, MAP_ALLOW_MAX_LEN); const DESC_MANAGER::DESC_SET & c_set = DESC_MANAGER::instance().GetClientSet(); DESC_MANAGER::DESC_SET::const_iterator it; diff --git a/src/game/src/input_db.cpp b/src/game/src/input_db.cpp index 49e1d1c..57ef9f2 100644 --- a/src/game/src/input_db.cpp +++ b/src/game/src/input_db.cpp @@ -1312,7 +1312,7 @@ void CInputDB::MapLocations(const char * c_pData) while (bCount--) { - for (int i = 0; i < 32; ++i) + for (int i = 0; i < MAP_ALLOW_MAX_LEN; ++i) { if (0 == pLoc->alMaps[i]) break;