From 6758032da90bda58cb49e1823637bc19a1f4cc32 Mon Sep 17 00:00:00 2001 From: Zhang Lubo Date: Thu, 10 Sep 2015 09:46:59 +0000 Subject: [PATCH] MdeModulePkg: PXE Driver's LoadFile protocol should check FilePath PXE driver's LoadFile protocol should check the input parameter FilePath to see whether it's a supported device path.If not, it should return invalid parameter, do not continue PXE boot. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo Reviewed-by: Fu Siyuan Reviewed-by: Ye Ting git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18435 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 4 ++++ MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h | 1 + 2 files changed, 5 insertions(+) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c index 4dd7944e6a..72923f1b38 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c @@ -2776,6 +2776,10 @@ EfiPxeLoadFile ( UINT64 TmpBufSize; BOOLEAN MediaPresent; + if (FilePath == NULL || !IsDevicePathEnd (FilePath)) { + return EFI_INVALID_PARAMETER; + } + Private = PXEBC_PRIVATE_DATA_FROM_LOADFILE (This); PxeBc = &Private->PxeBc; NewMakeCallback = FALSE; diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h index 6e88deae47..ce8d8add3f 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h @@ -33,6 +33,7 @@ typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA; #include #include +#include #include #include #include