1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-01 10:59:12 +00:00

Fix: Variable 0x85 had no bounds checks.

This commit is contained in:
frosch
2018-08-14 16:41:50 +02:00
committed by frosch
parent 703e7f8fc7
commit 6391d49277

View File

@@ -5907,7 +5907,8 @@ static uint32 GetParamVal(byte param, uint32 *cond_val)
/* Supported in Action 0x07 and 0x09, not 0x0D */
return 0;
} else {
uint32 param_val = _ttdpatch_flags[*cond_val / 0x20];
uint32 index = *cond_val / 0x20;
uint32 param_val = index < lengthof(_ttdpatch_flags) ? _ttdpatch_flags[index] : 0;
*cond_val %= 0x20;
return param_val;
}