summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-13 22:27:30 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-13 22:27:30 +0000
commitc94beabfdf8931a577823fa6350829fdb55addc0 (patch)
tree1db370e5e0cc0588ef08f148a896a3c461a125d6 /src/map/script.c
parentbf4b65be0723d75e3ef4a90bb6372dad4e614255 (diff)
downloadhercules-c94beabfdf8931a577823fa6350829fdb55addc0.tar.gz
hercules-c94beabfdf8931a577823fa6350829fdb55addc0.tar.bz2
hercules-c94beabfdf8931a577823fa6350829fdb55addc0.tar.xz
hercules-c94beabfdf8931a577823fa6350829fdb55addc0.zip
- Applied Rayce's dangling pointer fix when returning a temporary npc string variable (those starting with .@)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9864 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 832647b7f..e4f7e7e5e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4325,6 +4325,12 @@ BUILDIN_FUNC(return)
if( name[0] == '.' && name[1] == '@') {
// '@ 変数を参照渡しにすると危険なので値渡しにする
get_val(st,sd);
+ //Fix dangling pointer crash due when returning a temporary
+ // script variable (from Rayce/jA)
+ if(isstr(sd)) {
+ sd->type = C_STR;
+ sd->u.str = (char *)aStrdup(sd->u.str);
+ }
} else if( name[0] == '.' && !sd->ref) {
// ' 変数は参照渡しでも良いが、参照元が設定されていないと
// 元のスクリプトの値を差してしまうので補正する。