mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
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 <drjones@redhat.com> Message-id: 20170524091315.20284-1-drjones@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
993063fbb5
commit
a18e93125d
1 changed files with 2 additions and 1 deletions
|
@ -611,8 +611,9 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
size = read(fd, hdr, sizeof(uboot_image_header_t));
|
size = read(fd, hdr, sizeof(uboot_image_header_t));
|
||||||
if (size < 0)
|
if (size < sizeof(uboot_image_header_t)) {
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
bswap_uboot_header(hdr);
|
bswap_uboot_header(hdr);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue