From 82f196916e0cdee5884e6e602eddaf7036f0b650 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 11 Apr 1995 16:43:20 +0000 Subject: [PATCH] Submitted by: Wolfgang Solfrank Fix off-by-1-sector error in the range checking for the end of the root directory. It was possible for the root directory to overwrite the FAT. --- sys/fs/msdosfs/msdosfs_fat.c | 4 ++-- sys/msdosfs/msdosfs_fat.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index 9a8420cee8ff..06b30e460c4b 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_fat.c,v 1.4 1994/12/12 12:35:45 bde Exp $ */ +/* $Id: msdosfs_fat.c,v 1.5 1995/02/10 18:39:45 bde Exp $ */ /* $NetBSD: msdosfs_fat.c,v 1.12 1994/08/21 18:44:04 ws Exp $ */ /*- @@ -163,7 +163,7 @@ pcbmap(dep, findcn, bnp, cnp) */ if (cn == MSDOSFSROOT) { if (dep->de_Attributes & ATTR_DIRECTORY) { - if (findcn * pmp->pm_SectPerClust > pmp->pm_rootdirsize) { + if (findcn * pmp->pm_SectPerClust >= pmp->pm_rootdirsize) { if (cnp) *cnp = pmp->pm_rootdirsize / pmp->pm_SectPerClust; return E2BIG; diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c index 9a8420cee8ff..06b30e460c4b 100644 --- a/sys/msdosfs/msdosfs_fat.c +++ b/sys/msdosfs/msdosfs_fat.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_fat.c,v 1.4 1994/12/12 12:35:45 bde Exp $ */ +/* $Id: msdosfs_fat.c,v 1.5 1995/02/10 18:39:45 bde Exp $ */ /* $NetBSD: msdosfs_fat.c,v 1.12 1994/08/21 18:44:04 ws Exp $ */ /*- @@ -163,7 +163,7 @@ pcbmap(dep, findcn, bnp, cnp) */ if (cn == MSDOSFSROOT) { if (dep->de_Attributes & ATTR_DIRECTORY) { - if (findcn * pmp->pm_SectPerClust > pmp->pm_rootdirsize) { + if (findcn * pmp->pm_SectPerClust >= pmp->pm_rootdirsize) { if (cnp) *cnp = pmp->pm_rootdirsize / pmp->pm_SectPerClust; return E2BIG;