Follow up to 78b6c15

Fixed a possible buffer overflow in mapindex.c
This commit is contained in:
Lemongrass3110 2015-10-02 20:31:07 +02:00
parent 78b6c150d2
commit a760e01c59
2 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ unsigned short mapindex_name2idx(const char* name, const char *func) {
}
const char* mapindex_idx2name(unsigned short id, const char *func) {
if (id > MAX_MAPINDEX || !mapindex_exists(id)) {
if (id >= MAX_MAPINDEX || !mapindex_exists(id)) {
ShowDebug("(%s) mapindex_id2name: Requested name for non-existant map index [%d] in cache.\n", func, id);
return indexes[0].name; // dummy empty string so that the callee doesn't crash
}

View File

@ -17656,7 +17656,7 @@ BUILDIN_FUNC(unitskillusepos)
if (bl != NULL) {
if (bl->type == BL_NPC) {
if (!((TBL_NPC*)bl)->status.hp)
status_calc_npc(((TBL_NPC*)bl), SCO_FORCE);
status_calc_npc(((TBL_NPC*)bl), SCO_FIRST);
else
status_calc_npc(((TBL_NPC*)bl), SCO_NONE);
}