summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-07-03 05:24:38 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-07-03 05:24:38 +0200
commitb560da5de159468ee9b28e95b939b443cdfe1108 (patch)
tree2ea9595f6efb3280539abf4dfca4e47e7ff574c1
parent1dfebbd4966310387357cbddae600418a56df658 (diff)
downloadhercules-b560da5de159468ee9b28e95b939b443cdfe1108.tar.gz
hercules-b560da5de159468ee9b28e95b939b443cdfe1108.tar.bz2
hercules-b560da5de159468ee9b28e95b939b443cdfe1108.tar.xz
hercules-b560da5de159468ee9b28e95b939b443cdfe1108.zip
Prevent overflow when using gettimetick(0)
-rw-r--r--src/map/script.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index b49844320..75582d72f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11272,7 +11272,8 @@ static BUILDIN(gettimetick)
case 0:
default:
//type 0:(System Ticks)
- script_pushint(st,(int)timer->gettick()); // TODO: change this to int64 when we'll support 64 bit script values
+ // Conjunction with INT_MAX is done to prevent overflow. (Script variables are signed integers.)
+ script_pushint(st, timer->gettick() & INT_MAX); // TODO: change this to int64 when we'll support 64 bit script values
break;
}
return true;