summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-11 06:57:14 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-11 06:57:14 +0000
commitc0aedc4c41ebc4959344a283ac7ea4a2296fb204 (patch)
tree9dc1b6e1d647e029b2256dd5d76f5d601d9dace4 /src/map/pc.c
parent7f83ceb98c6b1e0f4c949eaf9e03715b68ab58ca (diff)
downloadhercules-c0aedc4c41ebc4959344a283ac7ea4a2296fb204.tar.gz
hercules-c0aedc4c41ebc4959344a283ac7ea4a2296fb204.tar.bz2
hercules-c0aedc4c41ebc4959344a283ac7ea4a2296fb204.tar.xz
hercules-c0aedc4c41ebc4959344a283ac7ea4a2296fb204.zip
Added safeguards to Redemptio's exp penalty code to prevent arithmetic overflow in case its requirement checks are somehow bypassed (see topic:152196).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13277 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index ca395d955..7774680f7 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5172,10 +5172,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
if(base_penalty) {
if (battle_config.pk_mode && src && src->type==BL_PC)
base_penalty*=2;
- if(sd->status.base_exp < base_penalty)
- sd->status.base_exp = 0;
- else
- sd->status.base_exp -= base_penalty;
+ sd->status.base_exp -= min(sd->status.base_exp, base_penalty);
clif_updatestatus(sd,SP_BASEEXP);
}
}
@@ -5193,10 +5190,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
if(base_penalty) {
if (battle_config.pk_mode && src && src->type==BL_PC)
base_penalty*=2;
- if(sd->status.job_exp < base_penalty)
- sd->status.job_exp = 0;
- else
- sd->status.job_exp -= base_penalty;
+ sd->status.job_exp -= min(sd->status.job_exp, base_penalty);
clif_updatestatus(sd,SP_JOBEXP);
}
}