Submitted by: Wolfgang Solfrank <ws@tools.de>

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.
This commit is contained in:
Bruce Evans 1995-04-11 16:43:20 +00:00
parent 7565491c79
commit 82f196916e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7754
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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;