MdeModulePkg/EsrtDxe: Add check for EsrtRepository

EsrtRepository might be NULL. So return EFI_OUT_OF_RESOURCES
when it is NULL.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
Shenglei Zhang 2019-10-15 10:56:05 +08:00 committed by Liming Gao
parent e34022dcbe
commit 3fb7e094ef
1 changed files with 10 additions and 0 deletions

View File

@ -239,6 +239,11 @@ DeleteEsrtEntry(
goto EXIT; goto EXIT;
} }
if (EsrtRepository == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto EXIT;
}
if ((RepositorySize % sizeof(EFI_SYSTEM_RESOURCE_ENTRY)) != 0) { if ((RepositorySize % sizeof(EFI_SYSTEM_RESOURCE_ENTRY)) != 0) {
DEBUG((EFI_D_ERROR, "Repository Corrupt. Need to rebuild Repository.\n")); DEBUG((EFI_D_ERROR, "Repository Corrupt. Need to rebuild Repository.\n"));
// //
@ -332,6 +337,11 @@ UpdateEsrtEntry(
&RepositorySize &RepositorySize
); );
if (EsrtRepository == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto EXIT;
}
if (!EFI_ERROR(Status)) { if (!EFI_ERROR(Status)) {
// //
// if exist, update Esrt cache repository // if exist, update Esrt cache repository