[mle] out-of-bounds read (OVERRUN) (#7214)

Fix issue after static code analyzer run.

Signed-off-by: Marek Porwisz <[email protected]>
This commit is contained in:
Marek Porwisz
2021-12-01 10:51:27 -08:00
committed by GitHub
parent 44837a1dae
commit 1267bdbf68
+1 -1
View File
@@ -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