[syslinux:master] win: Fix an out-of-bounds array access

syslinux-bot for Shao Miller shao.miller at yrdsb.edu.on.ca
Sat Dec 17 21:19:30 PST 2011


Commit-ID:  d782f2a2aec66486a62d41dbd4bca3b95fa295a8
Gitweb:     http://www.syslinux.org/commit/d782f2a2aec66486a62d41dbd4bca3b95fa295a8
Author:     Shao Miller <shao.miller at yrdsb.edu.on.ca>
AuthorDate: Mon, 29 Aug 2011 20:21:09 -0400
Committer:  Paulo Alcantara <pcacjr at gmail.com>
CommitDate: Sun, 11 Sep 2011 04:09:59 +0000

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 <shao.miller at yrdsb.edu.on.ca>
Signed-off-by: Paulo Alcantara <pcacjr at gmail.com>

---
 win/syslinux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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++;
 	    }


More information about the Syslinux-commits mailing list