Skip to content

Commit 98e25f1

Browse files
committed
unittests: Test_LoRaWANStack.acquire_rx_metadata: Fix SEGFAULT
We failed to set `LoRaMac_stub::mlme_ind_ptr` to a valid pointer. When we tried to dereference it in `LoRaWANStack::process_reception` we hit a SEGFAULT.
1 parent 421adc9 commit 98e25f1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

connectivity/lorawan/tests/UNITTESTS/features/lorawan/lorawanstack/Test_LoRaWANStack.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,11 @@ TEST_F(Test_LoRaWANStack, acquire_rx_metadata)
696696
cb.battery_level = batt_lvl;
697697
EXPECT_TRUE(LORAWAN_STATUS_OK == object->set_lora_callbacks(&cb));
698698
mlme.req_type = MLME_LINK_CHECK;
699+
700+
loramac_mlme_indication_t ind2;
701+
memset(&ind2, 0, sizeof(ind2));
702+
LoRaMac_stub::mlme_ind_ptr = &ind2;
703+
699704
mlme.status = LORAMAC_EVENT_INFO_STATUS_OK;
700705
LoRaMac_stub::bool_true_counter = true;
701706
radio._ev->rx_done(NULL, 0, 0, 0);

0 commit comments

Comments
 (0)