summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-03-29 23:56:51 -0300
committershennetsind <ind@henn.et>2014-03-29 23:56:51 -0300
commit7b430a5748662598743f7bb2c61bd4fe389cfd98 (patch)
treee03a65a9fecf924d7e6c8c306cd61a59392ce2b9 /src
parentf0229942aa9c92f4b7750fd2e56903d714a99351 (diff)
downloadhercules-7b430a5748662598743f7bb2c61bd4fe389cfd98.tar.gz
hercules-7b430a5748662598743f7bb2c61bd4fe389cfd98.tar.bz2
hercules-7b430a5748662598743f7bb2c61bd4fe389cfd98.tar.xz
hercules-7b430a5748662598743f7bb2c61bd4fe389cfd98.zip
Fixed getmapxy crash
getmapxy was failing to validate whether the variables passed met the necessary criteria. As reported in http://hercules.ws/board/topic/5113-map-crash-after-getmapxy/ by Javanese Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index c36d26626..296008536 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13270,6 +13270,24 @@ BUILDIN(getmapxy)
script_pushint(st,-1);
return false;
}
+
+ if( !is_string_variable(reference_getname(script_getdata(st, 2))) ) {
+ ShowWarning("script: buildin_getmapxy: %s is not a string variable\n",reference_getname(script_getdata(st, 2)));
+ script_pushint(st,-1);
+ return false;
+ }
+
+ if( is_string_variable(reference_getname(script_getdata(st, 3))) ) {
+ ShowWarning("script: buildin_getmapxy: %s is a string variable, should be int\n",reference_getname(script_getdata(st, 3)));
+ script_pushint(st,-1);
+ return false;
+ }
+
+ if( is_string_variable(reference_getname(script_getdata(st, 4))) ) {
+ ShowWarning("script: buildin_getmapxy: %s is a string variable, should be int\n",reference_getname(script_getdata(st, 4)));
+ script_pushint(st,-1);
+ return false;
+ }
// Possible needly check function parameters on C_STR,C_INT,C_INT
type=script_getnum(st,5);
@@ -13350,7 +13368,7 @@ BUILDIN(getmapxy)
num=st->stack->stack_data[st->start+2].u.num;
name=script->get_str(script_getvarid(num));
prefix=*name;
-
+
if(not_server_variable(prefix))
sd=script->rid2sd(st);
else