[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`.
This commit is contained in:
Abtin Keshavarzian
2025-07-29 17:02:11 -07:00
committed by GitHub
parent 34bb0e4ab1
commit 72ee935dec
+1 -1
View File
@@ -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); }