mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 01:55:41 +00:00
[DISK]: Small fixes:
- Check for malformed disk identifier, which must be at least 9 WCHARs long (as done by disk_new); - Prevent possible memory leaks (missing ExFreePool's) + closing registry key. Investigated by Lesan Ilie during tests; as part of CORE-13131. - Make one of our hacks more readable (by me). (We also note that this driver uses the ExAllocate/FreePool functions in the old-school way). svn path=/trunk/; revision=74509
This commit is contained in:
parent
4bb2162111
commit
0c9cd421ee
1 changed files with 14 additions and 1 deletions
|
@ -2286,7 +2286,7 @@ Return Value:
|
|||
outputBuffer->PartitionType = diskData->PartitionType;
|
||||
outputBuffer->StartingOffset = deviceExtension->StartingOffset;
|
||||
outputBuffer->PartitionLength.QuadPart = (diskData->PartitionNumber) ?
|
||||
deviceExtension->PartitionLength.QuadPart : 2305843009213693951LL; // HACK
|
||||
deviceExtension->PartitionLength.QuadPart : 0x1FFFFFFFFFFFFFFFLL; // HACK
|
||||
outputBuffer->HiddenSectors = diskData->HiddenSectors;
|
||||
outputBuffer->PartitionNumber = diskData->PartitionNumber;
|
||||
outputBuffer->BootIndicator = diskData->BootIndicator;
|
||||
|
@ -3921,6 +3921,17 @@ Return Value:
|
|||
ZwClose(targetKey);
|
||||
|
||||
if (!NT_SUCCESS(status)) {
|
||||
ExFreePool(keyData);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (keyData->DataLength < 9*sizeof(WCHAR)) {
|
||||
//
|
||||
// the data is too short to use (we subtract 9 chars in normal path)
|
||||
//
|
||||
DebugPrint((1, "EnumerateBusKey: Saved data was invalid, "
|
||||
"not enough data in registry!\n"));
|
||||
ExFreePool(keyData);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3943,6 +3954,7 @@ Return Value:
|
|||
TRUE);
|
||||
|
||||
if (!NT_SUCCESS(status)) {
|
||||
ExFreePool(keyData);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4124,6 +4136,7 @@ Return Value:
|
|||
DebugPrint((1,
|
||||
"SCSIDISK: ExtractBiosGeometry: Can't query configuration data (%x)\n",
|
||||
status));
|
||||
ZwClose(hardwareKey);
|
||||
ExFreePool(keyData);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue