[syslinux:master] core/diskboot.inc: fix handover area's sanity checks
syslinux-bot for Michal Soltys
soltys at ziu.info
Wed Mar 2 15:48:27 PST 2011
Commit-ID: 7a9ea9d8d8ee7b36012e3eb822a010bdca13a9d8
Gitweb: http://syslinux.zytor.com/commit/7a9ea9d8d8ee7b36012e3eb822a010bdca13a9d8
Author: Michal Soltys <soltys at ziu.info>
AuthorDate: Wed, 23 Feb 2011 00:18:00 +0100
Committer: H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Wed, 2 Mar 2011 15:46:21 -0800
core/diskboot.inc: fix handover area's sanity checks
As the code operates with paragraph granularity, make sure that
false positives are not possible, though some false negatives
might happen with insanely placed handover area.
Bump low address check to 50h:0, to also avoid bios data area and
remove si == 0 check.
Signed-off-by: Michal Soltys <soltys at ziu.info>
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
---
core/diskboot.inc | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/core/diskboot.inc b/core/diskboot.inc
index 35c6469..68672e4 100644
--- a/core/diskboot.inc
+++ b/core/diskboot.inc
@@ -180,16 +180,18 @@ floppy:
; trust that rather than what the superblock contains.
;
; Note: di points to beyond the end of PartInfo
+; Note: false negatives might slip through the handover area's sanity checks,
+; if the region is very close (less than a paragraph) to
+; PartInfo ; no false positives are possible though
;
harddisk:
mov dx,[di-76-10] ; Original DS
mov si,[di-76-12] ; Original SI
shr si,4
- jz .no_partition ; SI == 0 -> assume no partition
add dx,si
- cmp dx,1024 >> 4 ; DS:SI < 1K (inside the IVT)?
- jb .no_partition
- cmp dx,PartInfo >> 4 ; DS:SI in overwritten memory?
+ cmp dx,4fh ; DS:SI < 50h:0 (BDA or IVT) ?
+ jbe .no_partition
+ cmp dx,(PartInfo-75)>>4 ; DS:SI in overwritten memory?
jae .no_partition
test byte [di-76],7Fh ; Sanity check: "active flag" should
jnz .no_partition ; be 00 or 80
More information about the Syslinux-commits
mailing list