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 <simon.walz@autosen.com>
This commit is contained in:
Simon Walz 2024-09-16 14:53:19 +02:00 committed by Fabio Baltieri
parent c41d88740a
commit e20ef4443e

View file

@ -175,8 +175,7 @@ static int get_block_ctx(const struct lwm2m_obj_path *path, struct lwm2m_block_c
*ctx = NULL; *ctx = NULL;
for (i = 0; i < NUM_BLOCK1_CONTEXT; i++) { for (i = 0; i < NUM_BLOCK1_CONTEXT; i++) {
if (memcmp(path, &block1_contexts[i].path, if (lwm2m_obj_path_equal(path, &block1_contexts[i].path)) {
sizeof(struct lwm2m_obj_path)) == 0) {
*ctx = &block1_contexts[i]; *ctx = &block1_contexts[i];
/* refresh timestamp */ /* refresh timestamp */
(*ctx)->timestamp = k_uptime_get(); (*ctx)->timestamp = k_uptime_get();