[edk2] [Patch 4/5] NetworkPkg: Add assert for buffer pointer from DHCP driver.

Fu Siyuan posted 5 patches 6 years, 11 months ago
[edk2] [Patch 4/5] NetworkPkg: Add assert for buffer pointer from DHCP driver.
Posted by Fu Siyuan 6 years, 11 months ago
The PxeBcDhcp4CallBack() is provided for DHCP driver to invoke packet check
during DHCP process, the DHCP driver should make sure Packet and NewPacket
has meaningful value. This patch adds assert for this.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
index 9c33835759..b2c03eb269 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
@@ -1210,6 +1210,8 @@ PxeBcDhcp4CallBack (
     return EFI_SUCCESS;
   }
 
+  ASSERT (Packet != NULL);
+
   Private   = (PXEBC_PRIVATE_DATA *) Context;
   Mode      = Private->PxeBc.Mode;
   Callback  = Private->PxeBcCallback;
@@ -1305,6 +1307,8 @@ PxeBcDhcp4CallBack (
     break;
 
   case Dhcp4SelectOffer:
+    ASSERT (NewPacket != NULL);
+    
     //
     // Select offer by the default policy or by order, and record the SelectIndex
     // and SelectProxyType.
-- 
2.13.0.windows.1

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