From 00d12041f603364a0f04a4ce1894adc59cc527a2 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 15 Jul 2020 14:32:51 +0200 Subject: [PATCH] net: lwm2m: Initialize CoAP response on bootstrap finish During the bootstrap procedure, when Boostrap Finish was received, the response message was not initialized properly, resulting in a socket error (NULL pointer porovided) and the response not being sent. Signed-off-by: Robert Lubos --- subsys/net/lib/lwm2m/lwm2m_engine.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index f5c4659a84c..168daa78d40 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -3353,6 +3353,12 @@ static int handle_request(struct coap_packet *request, } else if ((code & COAP_REQUEST_MASK) == COAP_METHOD_POST && r == 1 && \ strncmp(options[0].value, "bs", options[0].len) == 0) { engine_bootstrap_finish(); + + r = lwm2m_init_message(msg); + if (r < 0) { + goto error; + } + return 0; #endif } else {