Fix maximum rotation value in GetBoardRotation()

Fix a memory overflow in case SENS_BOARD_ROT is set to Rotation::ROTATION_MAX (41) which is not a valid value

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2023-08-09 12:16:14 +03:00 committed by Beat Küng
parent ae70f9c640
commit c0084ab24d
1 changed files with 1 additions and 1 deletions

View File

@ -222,7 +222,7 @@ enum Rotation GetBoardRotation()
int32_t board_rot = -1;
param_get(param_find("SENS_BOARD_ROT"), &board_rot);
if (board_rot >= 0 && board_rot <= Rotation::ROTATION_MAX) {
if (board_rot >= 0 && board_rot < Rotation::ROTATION_MAX) {
return static_cast<enum Rotation>(board_rot);
} else {