diff options
author | frosch <frosch@openttd.org> | 2018-08-14 16:41:50 +0200 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2018-09-02 21:15:54 +0200 |
commit | 6391d4927744407d6ea8b7336dad34565bc986d0 (patch) | |
tree | 9761f855192aac7611bd5a2d11c9080d63d912e4 | |
parent | 703e7f8fc78a7032b7a5315092604fb62f471cb8 (diff) | |
download | openttd-6391d4927744407d6ea8b7336dad34565bc986d0.tar.xz |
Fix: Variable 0x85 had no bounds checks.
-rw-r--r-- | src/newgrf.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 4cd61b95c..216bdc190 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -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; } |