Skip to content

Commit

Permalink
Merge pull request contiki-ng#2841 from nvt/fix-coap-uninitialized-read
Browse files Browse the repository at this point in the history
coap: avoid possible read from uninitialized memory in debug mode.
  • Loading branch information
nfi committed Jan 12, 2024
2 parents 788256a + 154c940 commit b24f8ff
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions os/net/app-layer/coap/coap-callback-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ coap_request_callback(void *callback_data, coap_message_t *response)
coap_callback_request_state_t *callback_state = (coap_callback_request_state_t*)callback_data;
coap_request_state_t *state = &callback_state->state;

uint32_t res_block1;

state->response = response;

LOG_DBG("request callback\n");
Expand All @@ -106,6 +104,7 @@ coap_request_callback(void *callback_data, coap_message_t *response)

/* Got a response */
coap_get_header_block2(state->response, &state->res_block, &state->more, NULL, NULL);
uint32_t res_block1 = 0;
coap_get_header_block1(state->response, &res_block1, NULL, NULL, NULL);

LOG_DBG("Received #%lu%s B1:%lu (%u bytes)\n",
Expand Down

0 comments on commit b24f8ff

Please sign in to comment.