summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-07-28 10:15:22 +0300
committerToomas Soome <tsoome@me.com>2019-07-31 08:02:33 +0300
commit741b4d05bd52eb10a07f4f147bd8a211e5fe4351 (patch)
treebbac94d5cced14d199deea7ed98e7c1513fa0b30
parent9b73ad49e885405d1de7968ac2e3d8c72087aa7d (diff)
downloadillumos-joyent-741b4d05bd52eb10a07f4f147bd8a211e5fe4351.tar.gz
11502 installboot: find_multiboot() does crash with small files
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: Robert Mustacchi <robert.mustacchi@joyent.com> Reviewed by: Andy Fiddaman <andy@omniosce.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/boot/installboot/i386/installboot.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr/src/cmd/boot/installboot/i386/installboot.c b/usr/src/cmd/boot/installboot/i386/installboot.c
index 9e131ac626..80066b1430 100644
--- a/usr/src/cmd/boot/installboot/i386/installboot.c
+++ b/usr/src/cmd/boot/installboot/i386/installboot.c
@@ -201,7 +201,8 @@ read_bootblock_from_file(char *file, ib_bootblock_t *bblock)
goto outfd;
}
- if (find_multiboot(bblock->file, MBOOT_SCAN_SIZE, &mboot_off)
+ buf_size = MIN(buf_size, MBOOT_SCAN_SIZE);
+ if (find_multiboot(bblock->file, buf_size, &mboot_off)
!= BC_SUCCESS) {
(void) fprintf(stderr,
gettext("Unable to find multiboot header\n"));