[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 1/9] load_image_targphys() should enforce the max size
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH 1/9] load_image_targphys() should enforce the max size |
Date: |
Thu, 12 Jan 2012 16:46:20 +1100 |
From: Benjamin Herrenschmidt <address@hidden>
load_image_targphys() gets passed a max size for the file, but doesn't
enforce it at all. Add a check and return -1 (error) if the file is
too big, without loading it. Fix the bracing style in the function
while we're at it.
Signed-off-by: Benjamin Herrenschmidt <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/loader.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/hw/loader.c b/hw/loader.c
index 446b628..415cdce 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -108,8 +108,12 @@ int load_image_targphys(const char *filename,
int size;
size = get_image_size(filename);
- if (size > 0)
+ if (size > max_sz) {
+ return -1;
+ }
+ if (size > 0) {
rom_add_file_fixed(filename, addr, -1);
+ }
return size;
}
--
1.7.7.3
- [Qemu-ppc] [0/9] Bugfixes and pseries enhancements, David Gibson, 2012/01/12
- [Qemu-ppc] [PATCH 7/9] pseries: Use correct dispatcher for PCI config space accesses, David Gibson, 2012/01/12
- [Qemu-ppc] [PATCH 2/9] Fix dirty logging with 32-bit qemu & 64-bit guests, David Gibson, 2012/01/12
- [Qemu-ppc] [PATCH 1/9] load_image_targphys() should enforce the max size,
David Gibson <=
- [Qemu-ppc] [PATCH 6/9] pseries: Support PCI extended config space in RTAS calls, David Gibson, 2012/01/12
- [Qemu-ppc] [PATCH 5/9] Correct types in bmdma_addr_{read,write}, David Gibson, 2012/01/12
- [Qemu-ppc] [PATCH 8/9] pseries: Don't try to munmap() a malloc()ed TCE table, David Gibson, 2012/01/12
- [Qemu-ppc] [PATCH 3/9] pci: Make bounds checks on config space accesses actually work, David Gibson, 2012/01/12