From b8f01cef06f061dc0f985a020e8709cbfeb95cef Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Sat, 6 Aug 2022 10:51:07 +0100 Subject: [PATCH] net.c: Move variable into correct block It was possible to jump to skip_handler with added_block uninitialized. (Found by valgrind.) --- src/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net.c b/src/net.c index 06b7e873..208c1e7d 100644 --- a/src/net.c +++ b/src/net.c @@ -2598,6 +2598,7 @@ handle_request(coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu coap_string_t *query = NULL; coap_opt_t *observe = NULL; coap_string_t *uri_path = NULL; + int added_block = 0; #ifndef WITHOUT_ASYNC coap_bin_const_t tokenc = { pdu->token_length, pdu->token }; coap_async_t *async; @@ -2851,7 +2852,6 @@ handle_request(coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu if (coap_add_token(response, pdu->token_length, pdu->token)) { int observe_action = COAP_OBSERVE_CANCEL; coap_block_b_t block; - int added_block = 0; query = coap_get_query(pdu); /* check for Observe option RFC7641 and RFC8132 */