summaryrefslogtreecommitdiff
path: root/src/hexen/p_enemy.c
diff options
context:
space:
mode:
authorSimon Howard2014-11-27 16:54:05 -0500
committerSimon Howard2014-11-27 16:54:05 -0500
commit06821e944818e7f064aeb95cbdef5f12dd85a729 (patch)
tree0a5429c18b7673f5e78def94767b020c389bcb78 /src/hexen/p_enemy.c
parent5eeef20d70fc978372058371d29821dc27b019a5 (diff)
downloadchocolate-doom-06821e944818e7f064aeb95cbdef5f12dd85a729.tar.gz
chocolate-doom-06821e944818e7f064aeb95cbdef5f12dd85a729.tar.bz2
chocolate-doom-06821e944818e7f064aeb95cbdef5f12dd85a729.zip
hexen: audit calls to P_StartACS().
Scripts can have a maximum of three arguments when started (see ACS_Execute / #80 linedef special type). This means that the array of arguments passed must be at least three elements in length. When loading scripts, check the argument count never exceeds 3, and print a warning message if it does. Don't pass pointers to structure members implicitly treating them as elements of an array (as this relies on compiler-dependent behavior as to how structure members are laid out). Instead, copy values into a temporary array to make the intended behavior explicit. This fixes #477. Thanks to Quasar for reporting it.
Diffstat (limited to 'src/hexen/p_enemy.c')
-rw-r--r--src/hexen/p_enemy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c
index 1ad87032..18cc79eb 100644
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -4781,7 +4781,8 @@ void A_FreezeDeath(mobj_t * actor)
}
}
else if (actor->flags & MF_COUNTKILL && actor->special)
- { // Initiate monster death actions
+ {
+ // Initiate monster death actions.
P_ExecuteLineSpecial(actor->special, actor->args, NULL, 0, actor);
}
}
@@ -4933,7 +4934,7 @@ void A_KoraxChase(mobj_t * actor)
{
mobj_t *spot;
int lastfound;
- byte args[3] = { 0, 0, 0 };
+ byte args[3] = {0, 0, 0};
if ((!actor->special2.i) &&
(actor->health <= (actor->info->spawnhealth / 2)))