MdeModulePkg: Update IP4 driver to check for NULL pointer before using.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
Fu Siyuan 2018-06-27 09:16:04 +08:00
parent 7367cc6c24
commit a5f525fc48

View File

@ -1048,11 +1048,8 @@ Ip4Groups (
// is decreamented each time an address is removed..
//
for (Index = IpInstance->GroupCount; Index > 0 ; Index--) {
Group = 0;
if(IpInstance->Groups != NULL) {
Group = IpInstance->Groups[Index - 1];
}
ASSERT (IpInstance->Groups != NULL);
Group = IpInstance->Groups[Index - 1];
if ((GroupAddress == NULL) || EFI_IP4_EQUAL (&Group, GroupAddress)) {
if (EFI_ERROR (Ip4LeaveGroup (IpInstance, NTOHL (Group)))) {
return EFI_DEVICE_ERROR;