From 58e84d86b2716f07f31f79b0b0aeb2a8ebbf9b90 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Dec 2023 14:54:47 +0800 Subject: [PATCH] valid msg --- source/common/src/tmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 197750a6a8..c7e67c81f5 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -43,7 +43,7 @@ inline bool tmsgIsValid(tmsg_t type) { static int8_t sz = sizeof(tMsgRangeDict) / sizeof(tMsgRangeDict[0]); int segIdx = TMSG_SEG_CODE(type); - if (segIdx < sz) { + if (segIdx >= 0 && segIdx < sz) { return type < tMsgRangeDict[segIdx]; } return false;