summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-09 19:24:24 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-09 19:24:24 +0000
commit4780ea86190b3837ca9e80d39170feda377d72ed (patch)
tree1e229edb27898aa63abd3f9352ebc9ae453c1137 /src
parentb15e0c4634b8c8f62f7110617ed5c3ccf2078d04 (diff)
downloadhercules-4780ea86190b3837ca9e80d39170feda377d72ed.tar.gz
hercules-4780ea86190b3837ca9e80d39170feda377d72ed.tar.bz2
hercules-4780ea86190b3837ca9e80d39170feda377d72ed.tar.xz
hercules-4780ea86190b3837ca9e80d39170feda377d72ed.zip
- Added crash protection to the mob_db txt reading when the mob_db file has lines with insufficient number of columns.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8212 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/mob.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index eea96d008..d57272177 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3134,8 +3134,7 @@ static int mob_readdb(void)
} else
str[i]=p;
}
-
- class_ = atoi(str[0]);
+ class_ = str[0]?atoi(str[0]):0;
if (class_ == 0)
continue; //Leave blank lines alone... [Skotlex]
@@ -3148,6 +3147,10 @@ static int mob_readdb(void)
ShowWarning("Mob with ID: %d not loaded. That ID is reserved for player classes.\n");
continue;
}
+ if(i < 38+2*MAX_MOB_DROP) {
+ ShowWarning("mob_readdb: Insufficient columns for mob with ID: %d\n", class_);
+ continue;
+ }
if (mob_db_data[class_] == NULL)
mob_db_data[class_] = aCalloc(1, sizeof (struct mob_data));