From 5b0d97899242fda7218db813bb2a8b9ebfbe4637 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 20 Jun 2010 14:00:57 -0700 Subject: [PATCH] fat: fix off-by-one error in the FAT installer Fix off-by-one error in the FAT installer, which caused the install to incorrectly abort without the patched version of the data. Signed-off-by: H. Peter Anvin --- libinstaller/syslxmod.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c index b96e127..def4aab 100644 --- a/libinstaller/syslxmod.c +++ b/libinstaller/syslxmod.c @@ -311,8 +311,8 @@ int syslinux_patch(const sector_t *sectp, int nsectors, int secptroffset; uint64_t *advptrs; - if (nsectors <= nsect) - return -1; + if (nsectors < nsect) + return -1; /* The actual file is too small for content */ /* Handle RAID mode, write proper bsSignature */ i = get_16(&sbs->bsSignature); @@ -325,7 +325,8 @@ int syslinux_patch(const sector_t *sectp, int nsectors, /* Search for LDLINUX_MAGIC to find the patch area */ for (wp = (uint32_t *)boot_image; get_32_sl(wp) != LDLINUX_MAGIC; - wp++) ; + wp++) + ; patcharea = (struct patch_area *)wp; /* Set up the totals */ -- 2.7.4