- do not allow outside access to the variable storing the CCMD for OptionMenuItemCommand.

This can be abused to execute atbitrary commands from inside script code.
This commit is contained in:
Christoph Oelckers 2017-12-13 22:14:30 +01:00
parent 6b42036eb6
commit f3ac82e112

View file

@ -126,9 +126,12 @@ class OptionMenuItemSubmenu : OptionMenuItem
class OptionMenuItemCommand : OptionMenuItemSubmenu
{
private String ccmd; // do not allow access to this from the outside.
OptionMenuItemCommand Init(String label, Name command, bool centered = false)
{
Super.Init(label, command, 0, centered);
ccmd = command;
return self;
}
@ -146,7 +149,7 @@ class OptionMenuItemCommand : OptionMenuItemSubmenu
if (m.GetItem(mAction) != self) return false;
}
Menu.MenuSound("menu/choose");
DoCommand(mAction);
DoCommand(ccmd);
return true;
}