diff options
author | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-06-09 02:04:12 +0000 |
---|---|---|
committer | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-06-09 02:04:12 +0000 |
commit | 2788ff5116913c11e457382b42d4da19afc9e11c (patch) | |
tree | 2dbcdb717638e0ee9fba3927f40ed08fe5ba6495 /EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c | |
parent | 7830363c37c25097bc0322cd60310f03a349b81b (diff) | |
download | edk2-platforms-2788ff5116913c11e457382b42d4da19afc9e11c.tar.xz |
Fix the issue that if OEM SMBIOS data includes string, it will cause SmbiosFldMiscTypeOEM buffer overflow.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10569 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c')
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c index 3358a96672..5c62cc6b53 100644 --- a/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c +++ b/EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/MiscConv.c @@ -2391,30 +2391,28 @@ SmbiosFldMiscTypeOEM ( ASSERT_EFI_ERROR (Status);
if (StructureSize < RecordDataSize) {
- Status = SmbiosEnlargeStructureBuffer (
- StructureNode,
- ((EFI_SMBIOS_TABLE_HEADER *)RecordData)->Length,
- StructureSize,
- RecordDataSize
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ //
+ // Create new SMBIOS table entry
+ //
+ SmbiosUpdateStructureBuffer (
+ StructureNode,
+ RecordData
+ );
+ } else {
+ //
+ // Copy the entire data (including the Smbios structure header),
+ // but preserve the handle that is already allocated.
+ //
+ Handle = StructureNode->Structure->Handle;
+ CopyMem (
+ StructureNode->Structure,
+ RecordData,
+ RecordDataSize
+ );
+ StructureNode->Structure->Handle = Handle;
+ StructureNode->StructureSize = RecordDataSize;
}
- //
- // Copy the entire data (including the Smbios structure header),
- // but preserve the handle that is already allocated.
- //
- Handle = StructureNode->Structure->Handle;
- CopyMem (
- StructureNode->Structure,
- RecordData,
- RecordDataSize
- );
- StructureNode->Structure->Handle = Handle;
- StructureNode->StructureSize = RecordDataSize;
-
if (NewRecordData != NULL) {
FreePool (NewRecordData);
}
|