Skip to content

Commit 0e7e08e

Browse files
de-nordiccarlescufi
authored andcommitted
mgmt/mcumgr: Fix serial packet length not including CRC16
The length field of packet has not been including the length of CRC16 field. Fixes #39546 Signed-off-by: Dominik Ermel <[email protected]>
1 parent d788bc6 commit 0e7e08e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

subsys/mgmt/mcumgr/serial_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ int mcumgr_serial_tx_frame(const uint8_t *data, bool first, int len,
215215
* byte long is paired with first byte of input buffer to form triplet for Base64 encoding.
216216
*/
217217
if (first) {
218-
u16 = sys_cpu_to_be16(len);
218+
/* The size of the CRC16 should be added to packet length */
219+
u16 = sys_cpu_to_be16(len + 2);
219220
memcpy(raw, &u16, sizeof(u16));
220221
raw[2] = data[0];
221222

0 commit comments

Comments
 (0)