summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-02 01:36:14 +0000
committerParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-11-02 01:36:14 +0000
commitc4896b038c28f6639be143602fcb357e31a3293d (patch)
tree05c8c8c3c4a2e6d6e6392727138ac59d43556320
parent55b7526fef129aa129b1451fa2f55c76f3de3df6 (diff)
downloadhercules-c4896b038c28f6639be143602fcb357e31a3293d.tar.gz
hercules-c4896b038c28f6639be143602fcb357e31a3293d.tar.bz2
hercules-c4896b038c28f6639be143602fcb357e31a3293d.tar.xz
hercules-c4896b038c28f6639be143602fcb357e31a3293d.zip
Modified certain atcommands to use 64 bit arithmetic before capping a value to correct boundary logic for overflowing values.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14436 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/atcommand.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ec31d55d3..534edf3b3 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,5 +1,7 @@
Date Added
+2010/11/01
+ * Modified certain atcommands to use 64 bit arithmetic before capping a value to correct boundary logic for overflowing values. [Paradox924X]
2010/10/21
* Removed unused 'indoors' mapflag. [Gepard]
2010/10/17
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index bed466f48..a6eb86163 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2859,7 +2859,7 @@ int atcommand_statuspoint(const int fd, struct map_session_data* sd, const char*
if (point < 0 && sd->status.status_point < -point)
new_status_point = 0;
else
- new_status_point = cap_value(sd->status.status_point + point, 0, INT_MAX);
+ new_status_point = cap_value((int64)sd->status.status_point + point, 0, INT_MAX);
if (new_status_point != (int)sd->status.status_point) {
sd->status.status_point = new_status_point;
@@ -2892,7 +2892,7 @@ int atcommand_skillpoint(const int fd, struct map_session_data* sd, const char*
if (point < 0 && sd->status.skill_point < -point)
new_skill_point = 0;
else
- new_skill_point = cap_value(sd->status.skill_point + point, 0, INT_MAX);
+ new_skill_point = cap_value((int64)sd->status.skill_point + point, 0, INT_MAX);
if (new_skill_point != (int)sd->status.skill_point) {
sd->status.skill_point = new_skill_point;
@@ -2978,7 +2978,7 @@ int atcommand_param(const int fd, struct map_session_data* sd, const char* comma
status[5] = &sd->status.luk;
max = SHRT_MAX;
- new_value = cap_value(*status[i] + value, 1, max);
+ new_value = cap_value((int64)*status[i] + value, 1, max);
if (new_value != (int)*status[i]) {
*status[i] = new_value;