Change multi_send_macro to handle invalid inputs

No caller passes a key value other than [KEY_F9, KEY_F12].  If one did,
an invalid array reference would occur.  Restructure the code to return
on invalid inputs.  This fixes a flow control analysis warning.
This commit is contained in:
Kp 2016-08-25 04:05:31 +00:00
parent 89a2df0e18
commit 18a479a308

View file

@ -1260,13 +1260,13 @@ static void multi_message_feedback(void)
}
}
void
multi_send_macro(int key)
void multi_send_macro(const int fkey)
{
if (! (Game_mode & GM_MULTI) )
return;
switch(key)
unsigned key;
switch (fkey)
{
case KEY_F9:
key = 0; break;
@ -1278,6 +1278,7 @@ multi_send_macro(int key)
key = 3; break;
default:
Int3();
return;
}
if (!PlayerCfg.NetworkMessageMacro[key][0])