From b71a63e32beabec1d91029f88527c3462c80d758 Mon Sep 17 00:00:00 2001 From: ScureX <47725553+ScureX@users.noreply.github.com> Date: Mon, 5 Dec 2022 19:16:16 +0100 Subject: Fix calling `TitanEject` without arguments crashing server (#538) --- Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Northstar.CustomServers/mod/scripts/vscripts/titan') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut index 5f72385e..d0a2d5e4 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut @@ -68,6 +68,11 @@ bool function ClientCommand_TitanEject( entity player, array args ) if ( !PlayerCanEject( player ) ) return true + // check array length before accessing index to avoid oob access + // prevents crashing a server by just calling `TitanEject` without arguments + if( args.len() < 1 ) + return true + int ejectPressCount = args[ 0 ].tointeger() if ( ejectPressCount < 3 ) return true -- cgit v1.2.3