- Fix memory corruption when reading binary data

svn path=/trunk/; revision=40773
This commit is contained in:
Cameron Gutman 2009-05-02 20:46:50 +00:00
parent ce4f81375e
commit e32b96e4aa

View file

@ -615,14 +615,24 @@ NdisReadConfiguration(
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->Resource = *ParameterValue;
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead, &MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
(*ParameterValue)->ParameterType = ParameterType;
memcpy(&((*ParameterValue)->ParameterData.BinaryData), KeyInformation->Data, KeyInformation->DataLength);
ExFreePool(KeyInformation);
*Status = NDIS_STATUS_SUCCESS;