Skip to content

Commit

Permalink
unittests: Test_LoRaWANStack.acquire_rx_metadata: Fix SEGFAULT
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rwalton-arm committed Jul 26, 2021
1 parent bb95067 commit 0b711a4
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,11 @@ TEST_F(Test_LoRaWANStack, acquire_rx_metadata)
cb.battery_level = batt_lvl;
EXPECT_TRUE(LORAWAN_STATUS_OK == object->set_lora_callbacks(&cb));
mlme.req_type = MLME_LINK_CHECK;

loramac_mlme_indication_t ind2;
memset(&ind2, 0, sizeof(ind2));
LoRaMac_stub::mlme_ind_ptr = &ind2;

mlme.status = LORAMAC_EVENT_INFO_STATUS_OK;
LoRaMac_stub::bool_true_counter = true;
radio._ev->rx_done(NULL, 0, 0, 0);
Expand Down

0 comments on commit 0b711a4

Please sign in to comment.