summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/x86/x86-linux.h2
-rw-r--r--kexec/arch/i386/kexec-bzImage.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
index 59d35c9..2ebcc3a 100644
--- a/include/x86/x86-linux.h
+++ b/include/x86/x86-linux.h
@@ -233,7 +233,6 @@ struct x86_linux_header {
uint32_t high_base; /* 0x24C */
uint32_t high_memsz; /* 0x250 */
uint32_t high_filesz; /* 0x254 */
- uint32_t tail[32*1024 - 0x258]; /* 0x258 */
#else
uint32_t kernel_alignment; /* 0x230 */
uint8_t relocatable_kernel; /* 0x234 */
@@ -241,7 +240,6 @@ struct x86_linux_header {
uint32_t cmdline_size; /* 0x238 */
uint32_t hardware_subarch; /* 0x23C */
uint64_t hardware_subarch_data; /* 0x240 */
- uint8_t tail[32*1024 - 0x248]; /* 0x248 */
#endif
} PACKED;
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
index 54c4427..6998587 100644
--- a/kexec/arch/i386/kexec-bzImage.c
+++ b/kexec/arch/i386/kexec-bzImage.c
@@ -44,7 +44,10 @@ static const int probe_debug = 0;
int bzImage_probe(const char *buf, off_t len)
{
const struct x86_linux_header *header;
- if ((uintmax_t)len < (uintmax_t)sizeof(header)) {
+ if ((uintmax_t)len < (uintmax_t)(2 * 512)) {
+ if (probe_debug) {
+ fprintf(stderr, "File is too short to be a bzImage!\n");
+ }
return -1;
}
header = (const struct x86_linux_header *)buf;
@@ -118,7 +121,7 @@ int do_bzImage_load(struct kexec_info *info,
/*
* Find out about the file I am about to load.
*/
- if ((uintmax_t)kernel_len < (uintmax_t)sizeof(setup_header)) {
+ if ((uintmax_t)kernel_len < (uintmax_t)(2 * 512)) {
return -1;
}
memcpy(&setup_header, kernel, sizeof(setup_header));