* [Qemu-devel] [PATCH] load_uboot_image: don't assume a full header read
@ 2017-05-24 9:13 Andrew Jones
2017-05-30 11:54 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Jones @ 2017-05-24 9:13 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, pbonzini
Don't allow load_uboot_image() to proceed when less bytes than
header-size was read.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
hw/core/loader.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index bf17b42cbec2..f72930ca4a41 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -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);
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] load_uboot_image: don't assume a full header read
2017-05-24 9:13 [Qemu-devel] [PATCH] load_uboot_image: don't assume a full header read Andrew Jones
@ 2017-05-30 11:54 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2017-05-30 11:54 UTC (permalink / raw)
To: Andrew Jones; +Cc: QEMU Developers, Paolo Bonzini
On 24 May 2017 at 10:13, Andrew Jones <drjones@redhat.com> wrote:
> Don't allow load_uboot_image() to proceed when less bytes than
> header-size was read.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> hw/core/loader.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index bf17b42cbec2..f72930ca4a41 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-30 11:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 9:13 [Qemu-devel] [PATCH] load_uboot_image: don't assume a full header read Andrew Jones
2017-05-30 11:54 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.