MCUboot: boot_serial: BOOT_SERIAL_OUT_MAX is too small for worst case scenario

#if (128 + BOOT_SERIAL_IMAGE_STATE_SIZE_MAX + BOOT_SERIAL_HASH_SIZE_MAX) > \
BOOT_SERIAL_SLOT_INFO_SIZE_MAX
#define BOOT_SERIAL_MAX_MESSAGE_SIZE (128 + BOOT_SERIAL_IMAGE_STATE_SIZE_MAX + \
BOOT_SERIAL_HASH_SIZE_MAX)
#else
#define BOOT_SERIAL_MAX_MESSAGE_SIZE BOOT_SERIAL_SLOT_INFO_SIZE_MAX
#endif
#define BOOT_SERIAL_OUT_MAX (BOOT_SERIAL_MAX_MESSAGE_SIZE * BOOT_IMAGE_NUMBER)

Im currently running Zephyr RTOS with MCUBoot and when event i want use mcumgr-client to confirm the image i get an error because the CLI tool cant parse the response. After investigating i saw that the confirm function will call list as shown in the following

bs_list(state, buf, len);

I also saw that the buffer was too small to fit all the information for the two slots after confirming the second slot.

Im also building with CONFIG_BOOT_SERIAL_IMG_GRP_IMAGE_STATE=y which will result in MCUBOOT_SERIAL_IMG_GRP_IMAGE_STATE being defined and increasing the size of the repsonse.

Increase the size of BOOT_SERIAL_OUT_MAX since it is currently scaling with the number of images it would also make sense to scale this by the number of slots. Unfortunately i couldn;t calculate the worst case scenario for the response output size

Attached is also the .config of the MCUBoot child image
default.config.txt

Related