From c0019a8215949ca0b9de18b6c772dc0e8ccb334d Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 2 Oct 2007 11:17:36 -0700 Subject: [PATCH] bootsect.inc: make sure the $PnP header can fit inside the segment Terminate the search as soon as the $PnP header would fall outside the segment, not just the $PnP signature itself. --- bootsect.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootsect.inc b/bootsect.inc index 6989956..715100a 100644 --- a/bootsect.inc +++ b/bootsect.inc @@ -150,8 +150,8 @@ replace_bootstrap: cmp dword [fs:bx], "$PnP" jz .foundpnp inc bx - cmp bx,-3 ; Don't get a segment overflow error! - jb .findpnp + cmp bx,-21h ; Don't get a segment overflow error! + jbe .findpnp jmp .donepnp ; No $PnP header found .foundpnp: movzx cx,byte [fs:bx+5] ; Size of $PnP header -- 2.7.4