mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[FREELDR] iso.c: Perform extra validation before mounting the ISO filesystem (#7367)
Validate the primary volume descriptor version and its reported logical block size.
This commit is contained in:
parent
56eede6e38
commit
e2d0c7de30
1 changed files with 19 additions and 11 deletions
|
@ -168,7 +168,7 @@ static ARC_STATUS IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO I
|
|||
RtlZeroMemory(&IsoFileInfo, sizeof(ISO_FILE_INFO));
|
||||
|
||||
//
|
||||
// Read The Primary Volume Descriptor
|
||||
// Read the Primary Volume Descriptor
|
||||
//
|
||||
Position.HighPart = 0;
|
||||
Position.LowPart = 16 * SECTORSIZE;
|
||||
|
@ -502,9 +502,9 @@ const DEVVTBL* IsoMount(ULONG DeviceId)
|
|||
|
||||
TRACE("Enter IsoMount(%lu)\n", DeviceId);
|
||||
|
||||
//
|
||||
// Read The Primary Volume Descriptor
|
||||
//
|
||||
/*
|
||||
* Read the Primary Volume Descriptor
|
||||
*/
|
||||
Position.HighPart = 0;
|
||||
Position.LowPart = 16 * SECTORSIZE;
|
||||
Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
|
||||
|
@ -514,16 +514,24 @@ const DEVVTBL* IsoMount(ULONG DeviceId)
|
|||
if (Status != ESUCCESS || Count < sizeof(PVD))
|
||||
return NULL;
|
||||
|
||||
//
|
||||
// Check if PVD is valid. If yes, return ISO9660 function table
|
||||
//
|
||||
if (Pvd->VdType == 1 && RtlEqualMemory(Pvd->StandardId, "CD001", 5))
|
||||
/* Check if the PVD is valid */
|
||||
if (!(Pvd->VdType == 1 && RtlEqualMemory(Pvd->StandardId, "CD001", 5) && Pvd->VdVersion == 1))
|
||||
{
|
||||
TRACE("IsoMount(%lu) success\n", DeviceId);
|
||||
return &Iso9660FuncTable;
|
||||
WARN("Unrecognized CDROM format\n");
|
||||
return NULL;
|
||||
}
|
||||
if (Pvd->LogicalBlockSizeL != SECTORSIZE)
|
||||
{
|
||||
ERR("Unsupported LogicalBlockSize %u\n", Pvd->LogicalBlockSizeL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
Count = (ULONG)((ULONGLONG)Pvd->VolumeSpaceSizeL * SECTORSIZE / 1024 / 1024);
|
||||
TRACE("Recognized ISO9660 drive, size %lu MB (%lu sectors)\n",
|
||||
Count, Pvd->VolumeSpaceSizeL);
|
||||
|
||||
/* Everything OK, return the ISO9660 function table */
|
||||
return &Iso9660FuncTable;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue