From ad1898424cb775ca1aa807c317b7acfa62266dd3 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 18 Oct 2006 21:31:59 +0000 Subject: - Added a overflow check when calculating party exp share. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9010 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/party.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/map/party.c') diff --git a/src/map/party.c b/src/map/party.c index cc6939140..bc4f036a8 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -725,11 +725,15 @@ int party_exp_share(struct party_data *p,struct block_list *src,unsigned int bas job_exp/=c; if (base_exp/100 > UINT_MAX/bonus) base_exp= UINT_MAX; //Exp overflow + else if (base_exp > 10000) + base_exp = (base_exp/100)*bonus; //Calculation overflow protection else base_exp = base_exp*bonus/100; if (job_exp/100 > UINT_MAX/bonus) job_exp = UINT_MAX; + else if (job_exp > 10000) + job_exp = (job_exp/100)*bonus; else job_exp = job_exp*bonus/100; -- cgit v1.2.3-60-g2f50