]> git.baikalelectronics.ru Git - uboot.git/commit
tools: kwboot: Fix sending very small images
authorPali Rohár <pali@kernel.org>
Thu, 23 Mar 2023 19:57:54 +0000 (20:57 +0100)
committerStefan Roese <sr@denx.de>
Fri, 24 Mar 2023 12:13:47 +0000 (13:13 +0100)
commit201a098bb458302dc797512bd558bb47697df41d
tree7864913f1f3963292b3d8a0cdc02d0632c4c0db4
parentdb949ef41bfc82a616ce0ae566a3b13c7af259a6
tools: kwboot: Fix sending very small images

Sending of very small images (smaller than 128 bytes = xmodem block size)
cause out-of-bound memory read access. Fix this issue by ensuring that
hdrsz when sending image is not larger than total size of the image.
Issue was introduced in commit 20a6585838ca ("tools: kwboot: Fix sending
Kirkwood v0 images"). Special case when total image is smaller than header
size aligned to multiply of xmodem size is already handled since that
commit.

Fixes: 20a6585838ca ("tools: kwboot: Fix sending Kirkwood v0 images")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c