diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-07-30 19:22:07 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-07-30 19:22:07 -0700 |
commit | 2fde5ad3bb06c1d3bd0f187c0055cbcd2907fa9e (patch) | |
tree | 6d1f77ef42a34803f1b86d398c8174f443781c80 | |
parent | a8641f9842da20ad9c80ad28db8c10cdaaddfd55 (diff) | |
download | syslinux-2fde5ad3bb06c1d3bd0f187c0055cbcd2907fa9e.tar.gz |
chain.c32: error out on missing boot sector signature
If we're booting a disk or partition, then error out if the loaded
sector doesn't have a boot sector signature, rather than the
otherwise-inevitable crash.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | com32/modules/chain.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c index 2f79aaf4..979ede2d 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -814,6 +814,13 @@ int main(int argc, char *argv[]) } } + if (!opt.loadfile) { + if (*(uint16_t *)((char *)boot_sector+boot_size-2) != 0xaa55) { + error("Boot sector signature not found (unbootable disk/partition?)\n"); + goto bail; + } + } + if (partinfo) { /* 0x7BE is the canonical place for the first partition entry. */ regs.esi.w[0] = 0x7be; |