From 1267bdbf6897813ecd7c197df5d45cfe36027d21 Mon Sep 17 00:00:00 2001 From: Marek Porwisz <59468987+MarekPorwisz@users.noreply.github.com> Date: Wed, 1 Dec 2021 19:51:27 +0100 Subject: [PATCH] [mle] out-of-bounds read (OVERRUN) (#7214) Fix issue after static code analyzer run. Signed-off-by: Marek Porwisz --- src/core/thread/mle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index cf1967585..a96516e8e 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -4499,7 +4499,7 @@ const char *Mle::RoleToString(DeviceRole aRole) static_assert(kRoleRouter == 3, "kRoleRouter value is incorrect"); static_assert(kRoleLeader == 4, "kRoleLeader value is incorrect"); - return (aRole <= OT_ARRAY_LENGTH(kRoleStrings)) ? kRoleStrings[aRole] : "invalid"; + return (aRole < OT_ARRAY_LENGTH(kRoleStrings)) ? kRoleStrings[aRole] : "invalid"; } // LCOV_EXCL_START