diff options
author | shennetsind <ind@henn.et> | 2015-01-17 20:18:49 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2015-01-17 20:18:49 -0200 |
commit | a3c4d675ba19df385be5d1e3966c61de7186da57 (patch) | |
tree | 45b4a026a758afb1a54387cdadb91d55eba621f8 /src/map/pc.c | |
parent | 3e53a34615c2535dbed3d7c2c7a00f1ef3eaff0a (diff) | |
download | hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.tar.gz hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.tar.bz2 hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.tar.xz hercules-a3c4d675ba19df385be5d1e3966c61de7186da57.zip |
27 Fixes
Addressing out of bounds read/write, pointless null checks on already deferenced variables.
Special Thanks to 4144 and Haruna!
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 10b464570..6e9cc1e7a 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -886,11 +886,12 @@ int pc_isequip(struct map_session_data *sd,int n) item = sd->inventory_data[n]; - if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT)) - return 1; - if(item == NULL) return 0; + + if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT)) + return 1; + if(item->elv && sd->status.base_level < (unsigned int)item->elv){ clif->msg(sd, 0x6ED); return 0; @@ -9026,20 +9027,18 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) iflag = sd->npc_item_flag; /* check for combos (MUST be before status_calc_pc) */ - if ( id ) { - if( id->combos_count ) - pc->checkcombo(sd,id); - if(itemdb_isspecial(sd->status.inventory[n].card[0])) - ; //No cards - else { - for( i = 0; i < id->slot; i++ ) { - struct item_data *data; - if (!sd->status.inventory[n].card[i]) - continue; - if ( ( data = itemdb->exists(sd->status.inventory[n].card[i]) ) != NULL ) { - if( data->combos_count ) - pc->checkcombo(sd,data); - } + if( id->combos_count ) + pc->checkcombo(sd,id); + if(itemdb_isspecial(sd->status.inventory[n].card[0])) + ; //No cards + else { + for( i = 0; i < id->slot; i++ ) { + struct item_data *data; + if (!sd->status.inventory[n].card[i]) + continue; + if ( ( data = itemdb->exists(sd->status.inventory[n].card[i]) ) != NULL ) { + if( data->combos_count ) + pc->checkcombo(sd,data); } } } |