diff options
author | panikon <panikon@zoho.com> | 2014-05-06 21:14:46 -0300 |
---|---|---|
committer | panikon <panikon@zoho.com> | 2014-05-06 21:14:46 -0300 |
commit | 9a425c11b61fb6f4e299013c7d8d9841129b8f45 (patch) | |
tree | b8e8bc56c6e51679c23fe2de0e268f49b29f7288 /src/map/map.c | |
parent | 9cf6b362a0d5e2f52c017d747c0fa8f69a1a273f (diff) | |
download | hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.gz hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.bz2 hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.xz hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.zip |
Bug fixes and other changes
#Fixed issue where a corrupted map cache would lead to a crash
*Moved Big-endian compatibility functions to common/utils.h
#Fixed issue 8162
*http://hercules.ws/board/tracker/issue-8162-loadnpc-doesnt-trigger-oninit-of-duplicate-npcs/
*Added options to npc_parse_duplicate
#Fixed issue 8169
*http://hercules.ws/board/tracker/issue-8169-script-command-guildskill-skill-idlevel-not-working-as-intended/
*Changed *guildskill behavior, now it behaves exactly as depicted in the documentation
*Updated *guildskill documentation
#Added missing GBI types to mapif_parse_GuildBasicInfoChange now it's possible to change guild exp, lv, skill point and skill information
#GeoIP revamp
*GeoIP module was partially rewritten
*Added several data checks to prevent corruption and crashes
*Updated GeoIP database
*See https://github.com/maxmind/geoip-api-c/blob/master/libGeoIP/GeoIP.c for more information
#Added packetver checks regarding NST_MARKET
*Now *tradertype warns if user is trying to use this feature with older clients
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/map/map.c b/src/map/map.c index 04ac8a239..11ef56cb3 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2846,6 +2846,7 @@ int map_eraseipport(unsigned short map_index, uint32 ip, uint16 port) { * [Shinryo]: Init the mapcache *------------------------------------------*/ char *map_init_mapcache(FILE *fp) { + struct map_cache_main_header header; size_t size = 0; char *buffer; @@ -2869,6 +2870,19 @@ char *map_init_mapcache(FILE *fp) { return NULL; } + rewind(fp); + + // Get main header to verify if data is corrupted + if( fread(&header, sizeof(header), 1, fp) != 1 ) { + ShowError("map_init_mapcache: Error obtaining main header!\n"); + return NULL; + } + ShowError("Map cache is corrupted!\r"); // If the file is totally corrupted this will allow us to warn the user + if( GetULong((unsigned char *)&(header.file_size)) != size ) { + ShowError("map_init_mapcache: Map cache is corrupted!\n"); + return NULL; + } + return buffer; } |