mirror of
https://github.com/reactos/reactos.git
synced 2025-04-29 18:48:53 +00:00
- Fix memory corruption when reading binary data
svn path=/trunk/; revision=40773
This commit is contained in:
parent
ce4f81375e
commit
e32b96e4aa
1 changed files with 13 additions and 3 deletions
|
@ -615,14 +615,24 @@ NdisReadConfiguration(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*ParameterValue)->ParameterData.BinaryData.Buffer = ExAllocatePool(PagedPool, KeyInformation->DataLength);
|
||||||
|
if (!(*ParameterValue)->ParameterData.BinaryData.Buffer)
|
||||||
|
{
|
||||||
|
NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
|
||||||
|
ExFreePool(KeyInformation);
|
||||||
|
*Status = NDIS_STATUS_RESOURCES;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*ParameterValue)->ParameterType = ParameterType;
|
||||||
|
(*ParameterValue)->ParameterData.BinaryData.Length = KeyInformation->DataLength;
|
||||||
|
memcpy((*ParameterValue)->ParameterData.BinaryData.Buffer, KeyInformation->Data, KeyInformation->DataLength);
|
||||||
|
|
||||||
MiniportResource->ResourceType = 0;
|
MiniportResource->ResourceType = 0;
|
||||||
MiniportResource->Resource = *ParameterValue;
|
MiniportResource->Resource = *ParameterValue;
|
||||||
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
|
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
|
||||||
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead, &MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
|
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead, &MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
|
||||||
|
|
||||||
(*ParameterValue)->ParameterType = ParameterType;
|
|
||||||
memcpy(&((*ParameterValue)->ParameterData.BinaryData), KeyInformation->Data, KeyInformation->DataLength);
|
|
||||||
|
|
||||||
ExFreePool(KeyInformation);
|
ExFreePool(KeyInformation);
|
||||||
|
|
||||||
*Status = NDIS_STATUS_SUCCESS;
|
*Status = NDIS_STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue