Skip to content

Commit d2c29e7

Browse files
committed
mgmt: mcumgr: smp: Fix custom payload size
Fixes an issue when using custom payloads where the size was still using the zcbor buffer instead of the size of the network buffer Signed-off-by: Jamie McCrae <[email protected]>
1 parent 23232e6 commit d2c29e7

File tree

1 file changed

+9
-3
lines changed
  • subsys/mgmt/mcumgr/smp/src

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,15 @@ static int smp_handle_single_req(struct smp_streamer *streamer, const struct smp
310310
}
311311
#endif
312312

313-
smp_make_rsp_hdr(req_hdr, &rsp_hdr,
314-
zsp->payload_mut - nbw->nb->data - MGMT_HDR_SIZE);
315-
nbw->nb->len = zsp->payload_mut - nbw->nb->data;
313+
#if defined(CONFIG_MCUMGR_MGMT_CUSTOM_PAYLOAD)
314+
if (!mgmt_find_group(req_hdr->nh_group)->custom_payload) {
315+
#endif
316+
nbw->nb->len = zsp->payload_mut - nbw->nb->data;
317+
#if defined(CONFIG_MCUMGR_MGMT_CUSTOM_PAYLOAD)
318+
}
319+
#endif
320+
321+
smp_make_rsp_hdr(req_hdr, &rsp_hdr, (nbw->nb->len - MGMT_HDR_SIZE));
316322
smp_write_hdr(streamer, &rsp_hdr);
317323

318324
return 0;

0 commit comments

Comments
 (0)