load_uboot_image: don't assume a full header read
PATCH 1/1 load_uboot_image: don't assume a full header read
Don't allow load_uboot_image() to proceed when less bytes than header-size was read.
Signed-off-by Andrew Jones <[email protected]>
--- hw/core/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/core/loader.c +2 -1
@@ -611,8 +611,9 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,return -1 ; size =read (fd, hdr,sizeof (uboot_image_header_t)); -if (size <0 ) +if (size <sizeof (uboot_image_header_t)) { goto out; + }bswap_uboot_header (hdr);
Signature · 1 line
2.9.4
Peter Maydell
AppliedQuoted 13 lines · Andrew Jones
Don't allow
load_uboot_image()to proceed when less bytes than header-size was read.Signed-off-by Andrew Jones <[email protected]>--- hw/core/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/core/loader.c +0
-0
hw/core/loader.c static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, · line 619
Quoted 10 lines
hw/core/loader.c +2
-1@@ -611,8 +611,9 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,return -1 ; size =read (fd, hdr,sizeof (uboot_image_header_t)); -if (size <0 ) +if (size <sizeof (uboot_image_header_t)) { goto out; + }bswap_uboot_header (hdr);
Applied to target-arm.next, thanks.
-- PMM