Skip to content

Commit 67ce39b

Browse files
nordicjmjgl-meta
authored andcommitted
mgmt: mcumgt: smp: Fix not checking returned status
Fixes not checking if a zcbor operation was successful. Signed-off-by: Jamie McCrae <[email protected]> (cherry picked from commit c9a4764)
1 parent 22813dd commit 67ce39b

File tree

1 file changed

+8
-2
lines changed
  • subsys/mgmt/mcumgr/smp/src

1 file changed

+8
-2
lines changed

subsys/mgmt/mcumgr/smp/src/smp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,15 @@ static int smp_handle_single_payload(struct smp_streamer *cbuf, const struct smp
225225
}
226226

227227
if (handler_fn) {
228+
bool ok;
229+
228230
*handler_found = true;
229-
zcbor_map_start_encode(cbuf->writer->zs,
230-
CONFIG_MCUMGR_SMP_CBOR_MAX_MAIN_MAP_ENTRIES);
231+
ok = zcbor_map_start_encode(cbuf->writer->zs,
232+
CONFIG_MCUMGR_SMP_CBOR_MAX_MAIN_MAP_ENTRIES);
233+
234+
if (!ok) {
235+
return MGMT_ERR_EMSGSIZE;
236+
}
231237

232238
#if defined(CONFIG_MCUMGR_SMP_COMMAND_STATUS_HOOKS)
233239
cmd_recv.group = req_hdr->nh_group;

0 commit comments

Comments
 (0)