[mle] fix int conversion when setting TLV length (#11727)

This commit resolves a potential unsafe integer conversion warning by
explicitly casting the size of the status sub-TLV to `uint8_t` before
setting the length of the main TLV in
`SendLinkMetricsManagementResponse`.

Additionally, this change enables MLE_LINK_METRICS_SUBJECT_ENABLE`
feature in the `toranj` test configuration, allowing this feature to
be covered under its builds.
This commit is contained in:
Abtin Keshavarzian
2025-07-15 12:18:53 -07:00
committed by GitHub
parent d4734df8bb
commit 5f623944b2
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -2159,7 +2159,7 @@ Error Mle::SendLinkMetricsManagementResponse(const Ip6::Address &aDestination, L
tlv.SetType(Tlv::kLinkMetricsManagement);
statusSubTlv.SetType(LinkMetrics::SubTlv::kStatus);
statusSubTlv.SetLength(sizeof(aStatus));
tlv.SetLength(statusSubTlv.GetSize());
tlv.SetLength(static_cast<uint8_t>(statusSubTlv.GetSize()));
SuccessOrExit(error = message->Append(tlv));
SuccessOrExit(error = message->Append(statusSubTlv));
@@ -80,6 +80,8 @@
#define OPENTHREAD_CONFIG_DIAG_ENABLE 1
#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1
#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1