bootsect.inc: make sure the $PnP header can fit inside the segment
authorH. Peter Anvin <hpa@zytor.com>
Tue, 2 Oct 2007 18:17:36 +0000 (11:17 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 2 Oct 2007 18:17:53 +0000 (11:17 -0700)
Terminate the search as soon as the $PnP header would fall outside the
segment, not just the $PnP signature itself.

bootsect.inc

index 6989956..715100a 100644 (file)
@@ -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