Windows: Add checks on IOCTL_DISK_GET_DRIVE_LAYOUT_EX response to make Coverity happy.

This commit is contained in:
Mounir IDRASSI 2017-06-11 14:38:30 +02:00
parent 1662abb707
commit 70d083bfb2
No known key found for this signature in database
GPG Key ID: DD0C382D5FCFB8FC
1 changed files with 51 additions and 47 deletions

View File

@ -11995,9 +11995,12 @@ void UpdateMountableHostDeviceList ()
(LPVOID) buffer.data(),
(DWORD) buffer.size(),
(LPDWORD) &bytesReturned,
NULL))
NULL) && (bytesReturned >= sizeof (DRIVE_LAYOUT_INFORMATION_EX)))
{
PDRIVE_LAYOUT_INFORMATION_EX layout = (PDRIVE_LAYOUT_INFORMATION_EX) buffer.data();
// sanity checks
if (layout->PartitionCount <= 256)
{
for (DWORD i = 0; i < layout->PartitionCount; i++)
{
if (layout->PartitionEntry[i].PartitionStyle == PARTITION_STYLE_MBR)
@ -12054,6 +12057,7 @@ void UpdateMountableHostDeviceList ()
}
}
}
}
if (bIsDynamic)
dynamicVolumesPresent = true;