NetworkPkg: Check allocated buffer pointer before use.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
Fu Siyuan 2018-01-02 11:44:21 +08:00
parent 6a4eed9bad
commit 9f4f29cbee

View File

@ -2,7 +2,7 @@
Functions implementation related with DHCPv6 for UefiPxeBc Driver. Functions implementation related with DHCPv6 for UefiPxeBc Driver.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR> (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -2030,6 +2030,9 @@ PxeBcDhcp6CallBack (
SelectAd = &Private->OfferBuffer[Private->SelectIndex - 1].Dhcp6.Packet.Offer; SelectAd = &Private->OfferBuffer[Private->SelectIndex - 1].Dhcp6.Packet.Offer;
*NewPacket = AllocateZeroPool (SelectAd->Size); *NewPacket = AllocateZeroPool (SelectAd->Size);
ASSERT (*NewPacket != NULL); ASSERT (*NewPacket != NULL);
if (*NewPacket == NULL) {
return EFI_ABORTED;
}
CopyMem (*NewPacket, SelectAd, SelectAd->Size); CopyMem (*NewPacket, SelectAd, SelectAd->Size);
} }
break; break;