From e20ef4443eba176dcb281dd1e69eda74fb7146ab Mon Sep 17 00:00:00 2001 From: Simon Walz Date: Mon, 16 Sep 2024 14:53:19 +0200 Subject: [PATCH] net: lwm2m: check lwm2m path level while getting the block ctx The Block1 context for composite operations is not found, as all path levels are compared. The incoming path level should therefore always be taken into account. Signed-off-by: Simon Walz --- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 77a007ffcee..1b136fd8fdc 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -175,8 +175,7 @@ static int get_block_ctx(const struct lwm2m_obj_path *path, struct lwm2m_block_c *ctx = NULL; for (i = 0; i < NUM_BLOCK1_CONTEXT; i++) { - if (memcmp(path, &block1_contexts[i].path, - sizeof(struct lwm2m_obj_path)) == 0) { + if (lwm2m_obj_path_equal(path, &block1_contexts[i].path)) { *ctx = &block1_contexts[i]; /* refresh timestamp */ (*ctx)->timestamp = k_uptime_get();