From 7b430a5748662598743f7bb2c61bd4fe389cfd98 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 29 Mar 2014 23:56:51 -0300 Subject: 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 --- src/map/script.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/map') 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 -- cgit v1.2.3-70-g09d2