From: tye Date: Mon, 11 Jan 2010 10:56:53 +0000 (+0000) Subject: Add ASSERT () to make sure the array is accessed within the limit. X-Git-Tag: edk2-stable201903~16615 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=70b689905c0ea1c9782f45dcce66f37986e886d9;ds=sidebyside Add ASSERT () to make sure the array is accessed within the limit. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9709 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index e18f4ab474..485c09f963 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -375,6 +375,7 @@ SyslogBuildPacket ( // Pri = ((NET_SYSLOG_FACILITY & 31) << 3) | (Level & 7); gRT->GetTime (&Time, NULL); + ASSERT (Time.Month <= 12); // // Use %a to format the ASCII strings, %s to format UNICODE strings @@ -783,7 +784,7 @@ NetIp6IsNetEqual ( UINT8 Bit; UINT8 Mask; - ASSERT (Ip1 != NULL && Ip2 != NULL); + ASSERT ((Ip1 != NULL) && (Ip2 != NULL) && (PrefixLength < IP6_PREFIX_NUM)); if (PrefixLength == 0) { return TRUE; @@ -799,6 +800,7 @@ NetIp6IsNetEqual ( if (Bit > 0) { Mask = (UINT8) (0xFF << (8 - Bit)); + ASSERT (Byte < 16); if ((Ip1->Addr[Byte] & Mask) != (Ip2->Addr[Byte] & Mask)) { return FALSE; } @@ -2183,10 +2185,10 @@ NetLibDefaultAddressIsStatic ( IsStatic = TRUE; Status = gBS->LocateProtocol ( - &gEfiHiiConfigRoutingProtocolGuid, - NULL, - (VOID **) &HiiConfigRouting - ); + &gEfiHiiConfigRoutingProtocolGuid, + NULL, + (VOID **) &HiiConfigRouting + ); if (EFI_ERROR (Status)) { return TRUE; }