summaryrefslogtreecommitdiff
path: root/src/map/instance.c
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2015-12-04 17:23:30 +0100
committerHaruna <haru@dotalux.com>2015-12-04 17:23:30 +0100
commit81e02574f1d73807903bb611351581d7f9dc80e6 (patch)
tree6a0156620be7e62f3e9b1ed2f9d6cd3c9d0c4e90 /src/map/instance.c
parentb67c93a32c30690c546846a2a1ee1d035d7f3e24 (diff)
parent99cb5b4ae5d703878c421d3dd62ef626a7979130 (diff)
downloadhercules-81e02574f1d73807903bb611351581d7f9dc80e6.tar.gz
hercules-81e02574f1d73807903bb611351581d7f9dc80e6.tar.bz2
hercules-81e02574f1d73807903bb611351581d7f9dc80e6.tar.xz
hercules-81e02574f1d73807903bb611351581d7f9dc80e6.zip
Merge pull request #774 from 4144/mapchecks
Add missing checks to some files in map server
Diffstat (limited to 'src/map/instance.c')
-rw-r--r--src/map/instance.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/map/instance.c b/src/map/instance.c
index 45e407dfc..0f6e475b2 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -61,6 +61,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ
short *iptr = NULL;
int i;
+ nullpo_retr(-1, name);
switch ( type ) {
case IOT_NONE:
break;
@@ -158,6 +159,9 @@ int instance_add_map(const char *name, int instance_id, bool usebasename, const
int i, im = -1;
size_t num_cell, size, j;
+ nullpo_retr(-1, name);
+ nullpo_retr(-1, map_name);
+
if( m < 0 )
return -1; // source map not found
@@ -305,6 +309,7 @@ int instance_map2imap(int16 m, int instance_id) {
int instance_mapname2imap(const char *map_name, int instance_id) {
int i;
+ nullpo_retr(-1, map_name);
if( !instance->valid(instance_id) ) {
return -1;
}
@@ -322,6 +327,7 @@ int instance_mapname2imap(const char *map_name, int instance_id) {
* result : mapid of map "m" in this instance
*--------------------------------------*/
int instance_mapid2imapid(int16 m, int instance_id) {
+ Assert_retr(-1, m >= 0 && m < map->count);
if( map->list[m].flag.src4instance == 0 )
return m; // not instances found for this map
else if( map->list[m].instance_id >= 0 ) { // This map is a instance, not a src map instance
@@ -661,6 +667,7 @@ void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsign
void instance_check_kick(struct map_session_data *sd) {
int16 m = sd->bl.m;
+ nullpo_retv(sd);
clif->instance_leave(sd->fd);
if( map->list[m].instance_id >= 0 ) { // User was on the instance map
if( map->list[m].save.map )