From f0df33caf8239b8bfff566f6fdc62d99ea79b37c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 12 Nov 2026 22:04:20 -0600 Subject: [PATCH] Fix check for invalid motionType values --- src/InputStream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/InputStream.c b/src/InputStream.c index 79bc001..2df6de2 100644 --- a/src/InputStream.c +++ b/src/InputStream.c @@ -1628,7 +1628,8 @@ int LiSendControllerMotionEvent(uint8_t controllerNumber, uint8_t motionType, fl } // Check for valid motion type values - if (motionType - 1 >= MAX_MOTION_EVENTS) { + if (motionType <= 0 || motionType - 1 >= MAX_MOTION_EVENTS) { + LC_ASSERT(motionType > 0); LC_ASSERT(motionType - 1 < MAX_MOTION_EVENTS); return -3; }