Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boot_serial: fix image number handle in image upload request
According to the SMP protocol documentation [1], 'image number' value in 'image upload request' is optional and can be included only in packet with 'off' (data offset) set to '0' (first packet in upload request). In one of recent changes (commit 'cb07e888691d'), initialization of the 'img_num' variable was removed which, in extreme case (no image number provided in upload request), results in use of its uninitialized value in flash_area_open() call which then might lead to request abort. This fixes above regression and also makes MCUboot implementation of the 'image upload request' aligned with Zephyr documentation of the protocol by considering image number only from first (off == 0) 'image upload request' SMP packet. In addition, 'image number' value is set to '0' if the request doesn't provide this field. [1] docs.zephyrproject.org/latest/services/device_mgmt/smp_groups/smp_group_1.html Fixes: cb07e88 ("boot_serial: Replace cbor auto-generated code with zcbor functions") Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
- Loading branch information