summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2015-01-17 18:49:03 -0200
committershennetsind <ind@henn.et>2015-01-17 18:49:03 -0200
commit3e53a34615c2535dbed3d7c2c7a00f1ef3eaff0a (patch)
tree2f646d420976e459ef585debfca2ae55d3185528 /src/map/npc.c
parent348044f12d5f683c8945e0eac642f2795050fb4e (diff)
downloadhercules-3e53a34615c2535dbed3d7c2c7a00f1ef3eaff0a.tar.gz
hercules-3e53a34615c2535dbed3d7c2c7a00f1ef3eaff0a.tar.bz2
hercules-3e53a34615c2535dbed3d7c2c7a00f1ef3eaff0a.tar.xz
hercules-3e53a34615c2535dbed3d7c2c7a00f1ef3eaff0a.zip
Another ~10 Fixes
Addressing out of bounds read/write. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 28709d34f..8ecefb5a0 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3605,7 +3605,8 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
}
if (mobspawn.num > db->spawn[i].qty) {
//Insert into list
- memmove(&db->spawn[i+1], &db->spawn[i], sizeof(db->spawn) -(i+1)*sizeof(db->spawn[0]));
+ if( i != ARRAYLENGTH(db->spawn) - 1 )
+ memmove(&db->spawn[i+1], &db->spawn[i], sizeof(db->spawn) -(i+1)*sizeof(db->spawn[0]));
db->spawn[i].mapindex = map_id2index(mobspawn.m);
db->spawn[i].qty = mobspawn.num;
break;