From d782f2a2aec66486a62d41dbd4bca3b95fa295a8 Mon Sep 17 00:00:00 2001 From: Shao Miller Date: Mon, 29 Aug 2011 20:21:09 -0400 Subject: [PATCH] win: Fix an out-of-bounds array access We should not attempt to make a map of more LDLINUX.SYS sectors than we have. Simply multiplying a cluster count times the number of sectors per cluster does not account for unused sectors in the last used cluster. Signed-off-by: Shao Miller Signed-off-by: Paulo Alcantara --- win/syslinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/syslinux.c b/win/syslinux.c index 13f25b6..26e5a27 100644 --- a/win/syslinux.c +++ b/win/syslinux.c @@ -409,7 +409,7 @@ int main(int argc, char *argv[]) len.QuadPart = ((extent.NextVcn.QuadPart - extent.FirstVcn.QuadPart) * vol_info.SectorsPerCluster); - while (len.QuadPart--) { + while (len.QuadPart-- && nsectors < ldlinux_sectors) { *secp++ = lba.QuadPart++; nsectors++; } -- 2.7.4