Skip to content

Commit

Permalink
boot_serial: fix misuse of 'matched' param from zcbor_map_decode_bulk()
Browse files Browse the repository at this point in the history
The 'matched' param in zcbor_map_decode_bulk() function is 'pointer to
the counter of matched keys', not length of payload buffer.

Fixes: fac2cab ("boot_serial: Add image state set/get")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
  • Loading branch information
pepe2k authored and d3zd3z committed Jul 5, 2023
1 parent 82feb9a commit f2cb550
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion boot/boot_serial/src/boot_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ bs_set(char *buf, int len)
ok = zcbor_map_decode_bulk(zsd, image_set_state_decode, ARRAY_SIZE(image_set_state_decode),
&decoded) == 0;

if (!ok || len != decoded) {
if (!ok) {
rc = MGMT_ERR_EINVAL;
goto out;
}
Expand Down

0 comments on commit f2cb550

Please sign in to comment.