Skip to content

Commit c32be82

Browse files
dandanbimergify[bot]
authored andcommitted
MdeModulePkg/HiiDB: Remove configuration table when it's freed (CVE-2019-14586)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1995 Fix the corner case issue that the original configuration runtime memory is freed, but it is still exposed to the OS runtime. So this patch is to remove the configuration table to avoid being used in OS runtime when the configuration runtime memory is freed. Cc: Liming Gao <[email protected]> Cc: Eric Dong <[email protected]> Cc: Jian J Wang <[email protected]> Signed-off-by: Dandan Bi <[email protected]> Reviewed-by: Eric Dong <[email protected]> Reviewed-by: Jian J Wang <[email protected]>
1 parent f9713ab commit c32be82

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

MdeModulePkg/Universal/HiiDatabaseDxe/Database.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @file
22
Implementation for EFI_HII_DATABASE_PROTOCOL.
33
4-
Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
4+
Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
55
SPDX-License-Identifier: BSD-2-Clause-Patent
66
77
**/
@@ -3376,6 +3376,10 @@ HiiGetConfigRespInfo(
33763376
if (gRTConfigRespBuffer == NULL){
33773377
FreePool(ConfigAltResp);
33783378
DEBUG ((DEBUG_ERROR, "[HiiDatabase]: No enough memory resource to store the ConfigResp string.\n"));
3379+
//
3380+
// Remove from the System Table when the configuration runtime buffer is freed.
3381+
//
3382+
gBS->InstallConfigurationTable (&gEfiHiiConfigRoutingProtocolGuid, NULL);
33793383
return EFI_OUT_OF_RESOURCES;
33803384
}
33813385
} else {
@@ -3431,6 +3435,10 @@ HiiGetDatabaseInfo(
34313435
gRTDatabaseInfoBuffer = AllocateRuntimeZeroPool (gDatabaseInfoSize);
34323436
if (gRTDatabaseInfoBuffer == NULL){
34333437
DEBUG ((DEBUG_ERROR, "[HiiDatabase]: No enough memory resource to store the HiiDatabase info.\n"));
3438+
//
3439+
// Remove from the System Table when the configuration runtime buffer is freed.
3440+
//
3441+
gBS->InstallConfigurationTable (&gEfiHiiDatabaseProtocolGuid, NULL);
34343442
return EFI_OUT_OF_RESOURCES;
34353443
}
34363444
} else {

0 commit comments

Comments
 (0)