[syslinux:master] core, diskstart: add more sanity checks for handover info

syslinux-bot for H. Peter Anvin hpa at zytor.com
Tue Dec 14 09:57:35 PST 2010


Commit-ID:  56c070e477c96d964ed7beab216b113dac8de0ef
Gitweb:     http://syslinux.zytor.com/commit/56c070e477c96d964ed7beab216b113dac8de0ef
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Tue, 14 Dec 2010 09:53:42 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 14 Dec 2010 09:53:42 -0800

core, diskstart: add more sanity checks for handover info

In particular, somehow we failed to actually test for DS:SI = 0:0!
This tests both for SI < 16 and DS:SI < 1024.  The former of those
tests is a bit iffy and probably should be removed.

This should also be promoted into isohdpfx.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/diskstart.inc |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/core/diskstart.inc b/core/diskstart.inc
index c0301d4..3fc20e2 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -180,8 +180,11 @@ 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,PartInfo >> 4
+		cmp dx,1024		; DS:SI < 1K (inside the IVT)?
+		jb .no_partition
+		cmp dx,PartInfo >> 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