mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 02:39:52 +00:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user