From 72ee935dec439e3d66efc2418e9c537b46caae2f Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 29 Jul 2025 17:02:11 -0700 Subject: [PATCH] [netdiag] fix incorrect bitmask for `AnswerTlv` index (#11762) The `kIndexMask` within `AnswerTlv` was incorrectly defined as `0x7f`, which only covers the lower 7 bits of the `mFlagsIndex` field. This would improperly truncate the message index value. This change corrects the mask to `0x7fff`, which properly utilizes the lower 15 bits for the index, while the most significant bit remains reserved for the `kIsLastFlag`. --- src/core/thread/network_diagnostic_tlvs.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/thread/network_diagnostic_tlvs.hpp b/src/core/thread/network_diagnostic_tlvs.hpp index c7689afd2..d243e35b7 100644 --- a/src/core/thread/network_diagnostic_tlvs.hpp +++ b/src/core/thread/network_diagnostic_tlvs.hpp @@ -1044,7 +1044,7 @@ public: private: static constexpr uint16_t kIsLastFlag = 1 << 15; - static constexpr uint16_t kIndexMask = 0x7f; + static constexpr uint16_t kIndexMask = 0x7fff; uint16_t GetFlagsIndex(void) const { return BigEndian::HostSwap16(mFlagsIndex); } void SetFlagsIndex(uint16_t aFlagsIndex) { mFlagsIndex = BigEndian::HostSwap16(aFlagsIndex); }