From fc0d5f95143fe79e65992a971c0c0b80f89c8c51 Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 26 Jan 2008 15:18:32 +0000 Subject: Added an out-of-bounds crashfix for map_delobject and map_delobjectnofree. Added missing EOL to the 'hack on namerequest' console message. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12142 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 2 +- src/map/map.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index 5700aa435..5dde04300 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8072,7 +8072,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) //Possible bot? Thanks to veider and qspirit //FIXME: Still isn't perfected as clients keep asking for this on legitimate situations. char gm_msg[256]; - sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target.", sd->status.name, sd->status.account_id); + sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target.\n", sd->status.name, sd->status.account_id); ShowWarning(gm_msg); // information is sended to all online GM intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg); diff --git a/src/map/map.c b/src/map/map.c index 3900247fe..25265e59e 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1142,6 +1142,12 @@ int map_addobject(struct block_list *bl) *------------------------------------------*/ int map_delobjectnofree(int id) { + if( id < 0 || id >= MAX_FLOORITEM ) + { + ShowError("map_delobjectnofree: invalid object id '%d'!\n", id); + return 0; + } + if(objects[id]==NULL) return 0; @@ -1167,13 +1173,17 @@ int map_delobjectnofree(int id) *------------------------------------------*/ int map_delobject(int id) { - struct block_list *obj = objects[id]; + if( id < 0 || id >= MAX_FLOORITEM ) + { + ShowError("map_delobject: invalid object id '%d'!\n", id); + return 0; + } - if(obj==NULL) + if(objects[id]==NULL) return 0; map_delobjectnofree(id); - map_freeblock(obj); + map_freeblock(objects[id]); return 0; } -- cgit v1.2.3-60-g2f50