summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/kwboot.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 61a9c3065aa..dc690636007 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -1455,6 +1455,8 @@ kwboot_xmodem(int tty, const void *_img, size_t size, int baudrate)
* followed by the header. So align header size to xmodem block size.
*/
hdrsz += (KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) % KWBOOT_XM_BLKSZ;
+ if (hdrsz > size)
+ hdrsz = size;
pnum = 1;