[syslinux:pathbased] fat: fix off-by-one error in the FAT installer

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Jun 20 14:03:16 PDT 2010


Commit-ID:  5b0d97899242fda7218db813bb2a8b9ebfbe4637
Gitweb:     http://syslinux.zytor.com/commit/5b0d97899242fda7218db813bb2a8b9ebfbe4637
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 20 Jun 2010 14:00:57 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 20 Jun 2010 14:00:57 -0700

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 <hpa at zytor.com>


---
 libinstaller/syslxmod.c |    7 ++++---
 1 files 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 */



More information about the Syslinux-commits mailing list