Reviewed-by: Fu Siyuan <siyuan...@intel.com>



-----Original Message-----
From: Zhang, Lubo 
Sent: Wednesday, September 9, 2015 5:09 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>
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.

Cc: Fu Siyuan<siyuan...@intel.com>
Cc: Ye Ting<ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zh...@intel.com>
---
 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 4dd7944..72923f1 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -2774,10 +2774,14 @@ EfiPxeLoadFile (
   BOOLEAN                     NewMakeCallback;
   EFI_STATUS                  Status;
   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;
   Status          = EFI_DEVICE_ERROR;
 
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
index 6e88dea..ce8d8ad 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h
@@ -31,10 +31,11 @@ typedef struct _PXEBC_PRIVATE_DATA  PXEBC_PRIVATE_DATA;  
#include <Protocol/Arp.h>  #include <Protocol/Ip4.h>  #include 
<Protocol/Ip4Config2.h>
 
 #include <Library/DebugLib.h>
+#include <Library/DevicePathLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/MemoryAllocationLib.h>  #include 
<Library/UefiDriverEntryPoint.h>  #include <Library/UefiBootServicesTableLib.h>
 #include <Library/UefiLib.h>
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to