summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-26 15:18:32 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-26 15:18:32 +0000
commitfc0d5f95143fe79e65992a971c0c0b80f89c8c51 (patch)
tree80d560d555218e7e19fe4e0717000da249549398 /src/map/map.c
parent5514b1d63acfbe0fa0e51a855679769d4f013e35 (diff)
downloadhercules-fc0d5f95143fe79e65992a971c0c0b80f89c8c51.tar.gz
hercules-fc0d5f95143fe79e65992a971c0c0b80f89c8c51.tar.bz2
hercules-fc0d5f95143fe79e65992a971c0c0b80f89c8c51.tar.xz
hercules-fc0d5f95143fe79e65992a971c0c0b80f89c8c51.zip
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
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c16
1 files changed, 13 insertions, 3 deletions
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;
}