aboutsummaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorShao Miller <shao.miller@yrdsb.edu.on.ca>2011-08-29 20:21:09 -0400
committerPaulo Alcantara <pcacjr@gmail.com>2011-09-11 04:09:59 +0000
commitd782f2a2aec66486a62d41dbd4bca3b95fa295a8 (patch)
tree15921bbb500e2267ed4d233e835daf9bec74c7ed /win
parent8edf44b7fb1a4f29029b93c63285c4431358bbe1 (diff)
downloadsyslinux-d782f2a2aec66486a62d41dbd4bca3b95fa295a8.tar.gz
syslinux-d782f2a2aec66486a62d41dbd4bca3b95fa295a8.tar.xz
syslinux-d782f2a2aec66486a62d41dbd4bca3b95fa295a8.zip
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@yrdsb.edu.on.ca> Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Diffstat (limited to 'win')
-rw-r--r--win/syslinux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/win/syslinux.c b/win/syslinux.c
index 13f25b6d..26e5a278 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++;
}