Skip to content

Commit 290919b

Browse files
authored
[tests] fix uninitialized memory in nexus test 1_3_DBR_TC_7A (openthread#13168)
The test `test_1_3_DBR_TC_7A` was failing occasionally due to uninitialized stack memory in `NetworkData::OnMeshPrefixConfig config`. Because `OnMeshPrefixConfig` inherits from `otBorderRouterConfig` and does not automatically initialize its fields in its default constructor, declaring `NetworkData::OnMeshPrefixConfig config;` on the stack left its members (including `mDp` and `mNdDns` flags) with arbitrary stack garbage. If `mDp` (Domain Prefix flag) evaluated to true, it caused the registered `PRE_1` prefix to be erroneously processed as a Domain Prefix. Consequently, the border router did not include `PRE_1` as a Route Information Option (RIO) in its emitted Router Advertisements, causing packet verification to fail in Step 4. This commit fixes the issue by explicitly initializing the `config` struct using `config.Clear()` right after declaration.
1 parent 61be1c0 commit 290919b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tests/nexus/test_1_3_DBR_TC_7A.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ void Test_1_3_DBR_TC_7A(void)
189189
nexus.AddTestVar("PRE_1", kPre1Prefix);
190190

191191
NetworkData::OnMeshPrefixConfig config;
192+
config.Clear();
192193
SuccessOrQuit(AsCoreType(&config.mPrefix).FromString(kPre1Prefix));
193194
config.mPreference = NetworkData::kRoutePreferenceHigh;
194195
config.mPreferred = true;

0 commit comments

Comments
 (0)