Skip to content

Commit ee07327

Browse files
committed
network: Check radiotap fields are set in expected order
1 parent b4760da commit ee07327

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/network/utils/radiotap-header.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,12 @@ RadiotapHeader::UpdatePresentField(uint32_t field)
522522
NS_ASSERT_MSG(!(m_present.at(bitmaskIdx) & flag),
523523
"Radiotap field " << field << " already set in present field at index "
524524
<< bitmaskIdx);
525+
NS_ASSERT_MSG((m_present.at(bitmaskIdx) < flag) &&
526+
((m_present.size() == (bitmaskIdx + 1)) ||
527+
std::all_of(m_present.begin() + bitmaskIdx + 1,
528+
m_present.end(),
529+
[](uint32_t present) { return present == 0; })),
530+
"Radiotap fields not set in correct order");
525531
}
526532
if (const uint32_t morePresentWordFlag = (1 << RADIOTAP_MORE_PRESENT); bitmaskIdx > 0)
527533
{

0 commit comments

Comments
 (0)