summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/status.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 4a84ad664..625a5bd83 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.
+09/07/21
+ * Added proper bounds of INT_MIN to INT_MAX for hp/sp when being sent to/from status_damage/status_heal for negative values because of INT_MAX being (-INT_MIN - 1). [Paradox924X]
09/07/17
* Dead branches no longer check for players' level. (bugreport:3378) [Inkfish]
* The Lovers Card won't teleport anyone on PVP/WoE/BG maps. (bugreport:3371) [Inkfish]
diff --git a/src/map/status.c b/src/map/status.c
index eb480bc2c..857a0a7a7 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -637,12 +637,12 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
sp = 0; //Not a valid SP target.
if (hp < 0) { //Assume absorbed damage.
- status_heal(target, -hp, 0, 1);
+ status_heal(target, cap_value(-hp, INT_MIN, INT_MAX), 0, 1);
hp = 0;
}
if (sp < 0) {
- status_heal(target, 0, -sp, 1);
+ status_heal(target, 0, cap_value(-sp, INT_MIN, INT_MAX), 1);
sp = 0;
}
@@ -859,7 +859,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
sc = NULL;
if (hp < 0) {
- status_damage(NULL, bl, -hp, 0, 0, 1);
+ status_damage(NULL, bl, cap_value(-hp, INT_MIN, INT_MAX), 0, 0, 1);
hp = 0;
}
@@ -872,7 +872,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
}
if(sp < 0) {
- status_damage(NULL, bl, 0, -sp, 0, 1);
+ status_damage(NULL, bl, 0, cap_value(-sp, INT_MIN, INT_MAX), 0, 1);
sp = 0;
}