mboot: correct the detection of the multiboot header
authorH. Peter Anvin <hpa@zytor.com>
Mon, 12 Oct 2009 22:59:21 +0000 (15:59 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 12 Oct 2009 22:59:21 +0000 (15:59 -0700)
Correct the detection of the multiboot header.  The logic for
when the header extends past the file was backwards, which broke
non-ELF multiboot kernels completely.  Apparently they are few and far
between.

Reported-by: Klaus T. <nightos@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/mboot/map.c

index 1a788ef..887776f 100644 (file)
@@ -127,7 +127,7 @@ int map_image(void *ptr, size_t len)
        else
            mbh_len = 12;
 
-       if (i + mbh_len < len)
+       if (i + mbh_len > len)
            mbh_len = 0;        /* Invalid... */
        else
            break;              /* Found something... */