Fixed a bug in vfatGetNextDirEntry().

A valid file name was generated from a deleted LFN entry.
An overrun occurred, when a directory has more then 19 deleted LFN entries.

svn path=/trunk/; revision=2131
This commit is contained in:
Hartmut Birr 2001-08-01 15:59:24 +00:00
parent cad3eb8c42
commit 130bddfe9f

View file

@ -1,4 +1,4 @@
/* $Id: direntry.c,v 1.3 2001/07/28 07:05:56 hbirr Exp $ /* $Id: direntry.c,v 1.4 2001/08/01 15:59:24 hbirr Exp $
* *
* *
* FILE: DirEntry.c * FILE: DirEntry.c
@ -125,7 +125,8 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
cacheSegment); cacheSegment);
return STATUS_NO_MORE_ENTRIES; return STATUS_NO_MORE_ENTRIES;
} }
else if (vfatIsDirEntryLongName (&fatDirEntry [indexInPage])) else if (vfatIsDirEntryLongName (&fatDirEntry [indexInPage])
&& !vfatIsDirEntryDeleted (&fatDirEntry [indexInPage]))
{ {
DPRINT (" long name entry found at %d\n", *pDirectoryIndex); DPRINT (" long name entry found at %d\n", *pDirectoryIndex);
longNameEntry = (slot *) currentPage; longNameEntry = (slot *) currentPage;
@ -143,7 +144,7 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
DPRINT (" longName: [%S]\n", pLongFileName); DPRINT (" longName: [%S]\n", pLongFileName);
cpos = 0; cpos = 0;
while ((longNameEntry [indexInPage].id != 0x41) && while ((longNameEntry [indexInPage].id != 0x41) &&
(longNameEntry [indexInPage].id != 0x01) && (longNameEntry [indexInPage].id != 0x01) &&
(longNameEntry [indexInPage].attr > 0)) (longNameEntry [indexInPage].attr > 0))
{ {
@ -161,8 +162,8 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
{ {
return status; return status;
} }
status = vfatRequestAndValidateRegion (pDeviceExt, status = vfatRequestAndValidateRegion (pDeviceExt,
pDirectoryFCB, pDirectoryFCB,
pageNumber * CACHEPAGESIZE(pDeviceExt), pageNumber * CACHEPAGESIZE(pDeviceExt),
(PVOID *) &currentPage, (PVOID *) &currentPage,
&cacheSegment, &cacheSegment,
@ -203,8 +204,8 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
{ {
return status; return status;
} }
status = vfatRequestAndValidateRegion (pDeviceExt, status = vfatRequestAndValidateRegion (pDeviceExt,
pDirectoryFCB, pDirectoryFCB,
pageNumber * CACHEPAGESIZE(pDeviceExt), pageNumber * CACHEPAGESIZE(pDeviceExt),
(PVOID *) &currentPage, (PVOID *) &currentPage,
&cacheSegment, &cacheSegment,