Skip to content

Commit

Permalink
mgmt: mcumgt: smp: Fix not checking returned status
Browse files Browse the repository at this point in the history
Fixes not checking if a zcbor operation was successful.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
(cherry picked from commit c9a4764)
  • Loading branch information
nordicjm authored and jgl-meta committed Aug 17, 2023
1 parent 22813dd commit 67ce39b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions subsys/mgmt/mcumgr/smp/src/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,15 @@ static int smp_handle_single_payload(struct smp_streamer *cbuf, const struct smp
}

if (handler_fn) {
bool ok;

*handler_found = true;
zcbor_map_start_encode(cbuf->writer->zs,
CONFIG_MCUMGR_SMP_CBOR_MAX_MAIN_MAP_ENTRIES);
ok = zcbor_map_start_encode(cbuf->writer->zs,
CONFIG_MCUMGR_SMP_CBOR_MAX_MAIN_MAP_ENTRIES);

if (!ok) {
return MGMT_ERR_EMSGSIZE;
}

#if defined(CONFIG_MCUMGR_SMP_COMMAND_STATUS_HOOKS)
cmd_recv.group = req_hdr->nh_group;
Expand Down

0 comments on commit 67ce39b

Please sign in to comment.