diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-10-18 21:31:59 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-10-18 21:31:59 +0000 |
commit | ad1898424cb775ca1aa807c317b7acfa62266dd3 (patch) | |
tree | 416f66a01ea0b1a18cec5729e203187488320453 | |
parent | 6e1b26ac5719d627e6e23b5909e07cc58f76a244 (diff) | |
download | hercules-ad1898424cb775ca1aa807c317b7acfa62266dd3.tar.gz hercules-ad1898424cb775ca1aa807c317b7acfa62266dd3.tar.bz2 hercules-ad1898424cb775ca1aa807c317b7acfa62266dd3.tar.xz hercules-ad1898424cb775ca1aa807c317b7acfa62266dd3.zip |
- 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
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/map/party.c | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index cda0418a0..9325b699e 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,8 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2006/10/18
+ * Added a overflow check when calculating party exp share. [Skotlex]
2006/10/16
* Adjusted UTSUSEMI/BUNSINJYUTSU so that they block range/melee weapon
attacks and only melee misc attacks. This isn't 100% correct, but it's a
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;
|