summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-11-24 21:25:51 +0300
committerAndrei Karas <akaras@inbox.ru>2018-12-12 21:18:06 +0300
commit15f51b36f4eb881b33bd56b434ba181d3add754d (patch)
tree4f35e89d044c8e66c7a7cd8b82b7d08b1127dcb4
parent2d33d766bd7ea81eb40c15fe45d59ab155b16fde (diff)
downloadhercules-15f51b36f4eb881b33bd56b434ba181d3add754d.tar.gz
hercules-15f51b36f4eb881b33bd56b434ba181d3add754d.tar.bz2
hercules-15f51b36f4eb881b33bd56b434ba181d3add754d.tar.xz
hercules-15f51b36f4eb881b33bd56b434ba181d3add754d.zip
Add some missing checks for inventory index variable.
-rw-r--r--src/map/clif.c1
-rw-r--r--src/map/pc.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 4d298f520..3f45c7aca 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3824,6 +3824,7 @@ static void clif_equipitemack(struct map_session_data *sd, int n, int pos, enum
p.index = n+2;
p.wearLocation = pos;
#if PACKETVER >= 20100629
+ Assert_retv(n >= 0 && n < MAX_INVENTORY);
if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&EQP_VISIBLE)
p.wItemSpriteNumber = sd->inventory_data[n]->view_sprite;
else
diff --git a/src/map/pc.c b/src/map/pc.c
index fcd36a233..0a2508f29 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1073,6 +1073,7 @@ static int pc_isequip(struct map_session_data *sd, int n)
struct item_data *item;
nullpo_ret(sd);
+ Assert_ret(n >= 0 && n < MAX_INVENTORY);
item = sd->inventory_data[n];