summaryrefslogtreecommitdiff
path: root/kexec/arch/i386/kexec-bzImage.c
diff options
context:
space:
mode:
Diffstat (limited to 'kexec/arch/i386/kexec-bzImage.c')
-rw-r--r--kexec/arch/i386/kexec-bzImage.c7
1 files changed, 5 insertions, 2 deletions
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));