refine the code and add more security check.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9691 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2010-01-08 02:35:56 +00:00
parent 33338afebd
commit e285199897
18 changed files with 499 additions and 493 deletions

View File

@ -2,7 +2,7 @@
This library is only intended to be used by UEFI network stack modules. This library is only intended to be used by UEFI network stack modules.
It provides basic functions for the UEFI network stack. It provides basic functions for the UEFI network stack.
Copyright (c) 2005 - 2009, Intel Corporation Copyright (c) 2005 - 2010, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1025,9 +1025,9 @@ NetLibGetVlanId (
This function will append VLAN device path node to the parent device path, This function will append VLAN device path node to the parent device path,
and then use LocateDevicePath() to find the correct VLAN device handle. and then use LocateDevicePath() to find the correct VLAN device handle.
@param[in] ServiceHandle The handle where network service binding protocols are @param[in] ControllerHandle The handle where network service binding protocols are
installed on. installed on.
@param[in] VLanId The configured VLAN ID for the VLAN device. @param[in] VlanId The configured VLAN ID for the VLAN device.
@return The VLAN device handle, or NULL if not found. @return The VLAN device handle, or NULL if not found.

View File

@ -196,12 +196,13 @@ BOOLEAN
); );
/** /**
Cancel all sent datagrams selected by the parameter ToCancel. Cancel all the sent datagram that pass the selection criteria of ToCancel.
If ToCancel is NULL, all the datagrams are cancelled. If ToCancel is NULL, all the datagrams are cancelled.
@param[in] UdpIo The UDP_IO to cancel packet. @param[in] UdpIo The UDP_IO to cancel packet.
@param[in] IoStatus The IoStatus to return to the packet owners. @param[in] IoStatus The IoStatus to return to the packet owners.
@param[in] ToCancel Sets the criteria for canceling a packet. @param[in] ToCancel The select funtion to test whether to cancel this
packet or not.
@param[in] Context The opaque parameter to the ToCancel. @param[in] Context The opaque parameter to the ToCancel.
**/ **/
@ -210,7 +211,7 @@ EFIAPI
UdpIoCancelDgrams ( UdpIoCancelDgrams (
IN UDP_IO *UdpIo, IN UDP_IO *UdpIo,
IN EFI_STATUS IoStatus, IN EFI_STATUS IoStatus,
IN UDP_IO_TO_CANCEL ToCancel OPTIONAL, IN UDP_IO_TO_CANCEL ToCancel, OPTIONAL
IN VOID *Context IN VOID *Context
); );
@ -218,10 +219,9 @@ UdpIoCancelDgrams (
Creates a UDP_IO to access the UDP service. It creates and configures Creates a UDP_IO to access the UDP service. It creates and configures
a UDP child. a UDP child.
This function: It locates the UDP service binding prototype on the Controller parameter
# locates the UDP service binding prototype on the Controller parameter uses the UDP service binding prototype to create a UDP child (also known as
# uses the UDP service binding prototype to create a UDP child (also known as a UDP instance) a UDP instance) configures the UDP child by calling Configure function prototype.
# configures the UDP child by calling Configure function prototype.
Any failures in creating or configuring the UDP child return NULL for failure. Any failures in creating or configuring the UDP child return NULL for failure.
@param[in] Controller The controller that has the UDP service binding. @param[in] Controller The controller that has the UDP service binding.

View File

@ -1,7 +1,7 @@
/** @file /** @file
Network library. Network library.
Copyright (c) 2005 - 2009, Intel Corporation.<BR> Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1530,7 +1530,7 @@ EFIAPI
NetMapIterate ( NetMapIterate (
IN NET_MAP *Map, IN NET_MAP *Map,
IN NET_MAP_CALLBACK CallBack, IN NET_MAP_CALLBACK CallBack,
IN VOID *Arg IN VOID *Arg OPTIONAL
) )
{ {
@ -1900,9 +1900,9 @@ NetLibGetVlanId (
This function will append VLAN device path node to the parent device path, This function will append VLAN device path node to the parent device path,
and then use LocateDevicePath() to find the correct VLAN device handle. and then use LocateDevicePath() to find the correct VLAN device handle.
@param[in] ServiceHandle The handle where network service binding protocols are @param[in] ControllerHandle The handle where network service binding protocols are
installed on. installed on.
@param[in] VLanId The configured VLAN ID for the VLAN device. @param[in] VlanId The configured VLAN ID for the VLAN device.
@return The VLAN device handle, or NULL if not found. @return The VLAN device handle, or NULL if not found.
@ -2399,7 +2399,7 @@ NetLibGetNicHandle (
Handle = NULL; Handle = NULL;
for (Index = 0; Index < OpenCount; Index++) { for (Index = 0; Index < OpenCount; Index++) {
if (OpenBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) { if ((OpenBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
Handle = OpenBuffer[Index].ControllerHandle; Handle = OpenBuffer[Index].ControllerHandle;
break; break;
} }

View File

@ -557,10 +557,9 @@ UdpIoCreateTxToken (
Creates a UDP_IO to access the UDP service. It creates and configures Creates a UDP_IO to access the UDP service. It creates and configures
a UDP child. a UDP child.
This function: It locates the UDP service binding prototype on the Controller parameter
# locates the UDP service binding prototype on the Controller parameter uses the UDP service binding prototype to create a UDP child (also known as
# uses the UDP service binding prototype to create a UDP child (also known as a UDP instance) a UDP instance) configures the UDP child by calling Configure function prototype.
# configures the UDP child by calling Configure function prototype.
Any failures in creating or configuring the UDP child return NULL for failure. Any failures in creating or configuring the UDP child return NULL for failure.
@param[in] Controller The controller that has the UDP service binding. @param[in] Controller The controller that has the UDP service binding.

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2006 - 2009, Intel Corporation.<BR> Copyright (c) 2006 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -315,6 +315,7 @@ Dhcp4DriverBindingStart (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
ASSERT (DhcpSb != NULL);
// //
// Start the receiving // Start the receiving

View File

@ -1,7 +1,7 @@
/** @file /** @file
This file implement the EFI_DHCP4_PROTOCOL interface. This file implement the EFI_DHCP4_PROTOCOL interface.
Copyright (c) 2006 - 2009, Intel Corporation.<BR> Copyright (c) 2006 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -647,15 +647,15 @@ EfiDhcp4Configure (
} }
if (Dhcp4CfgData != NULL) { if (Dhcp4CfgData != NULL) {
if (Dhcp4CfgData->DiscoverTryCount && (Dhcp4CfgData->DiscoverTimeout == NULL)) { if ((Dhcp4CfgData->DiscoverTryCount != 0) && (Dhcp4CfgData->DiscoverTimeout == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Dhcp4CfgData->RequestTryCount && (Dhcp4CfgData->RequestTimeout == NULL)) { if ((Dhcp4CfgData->RequestTryCount != 0) && (Dhcp4CfgData->RequestTimeout == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (Dhcp4CfgData->OptionCount && (Dhcp4CfgData->OptionList == NULL)) { if ((Dhcp4CfgData->OptionCount != 0) && (Dhcp4CfgData->OptionList == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
This file is for Challenge-Handshake Authentication Protocol (CHAP) Configuration. This file is for Challenge-Handshake Authentication Protocol (CHAP) Configuration.
Copyright (c) 2004 - 2009, Intel Corporation.<BR> Copyright (c) 2004 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -106,7 +106,7 @@ IScsiCHAPAuthTarget (
VerifyRsp VerifyRsp
); );
if (CompareMem (VerifyRsp, TargetResponse, ISCSI_CHAP_RSP_LEN)) { if (CompareMem (VerifyRsp, TargetResponse, ISCSI_CHAP_RSP_LEN) != 0) {
Status = EFI_SECURITY_VIOLATION; Status = EFI_SECURITY_VIOLATION;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
The driver binding and service binding protocol for IP4 driver. The driver binding and service binding protocol for IP4 driver.
Copyright (c) 2005 - 2009, Intel Corporation.<BR> Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -446,6 +446,7 @@ Ip4DriverBindingStart (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
ASSERT (IpSb != NULL);
// //
// Install the Ip4ServiceBinding Protocol onto ControlerHandle // Install the Ip4ServiceBinding Protocol onto ControlerHandle

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2005 - 2009, Intel Corporation.<BR> Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1693,7 +1693,7 @@ Ip4TxTokenValid (
// Check the source and gateway: they must be a valid unicast. // Check the source and gateway: they must be a valid unicast.
// Gateway must also be on the connected network. // Gateway must also be on the connected network.
// //
if (TxData->OverrideData) { if (TxData->OverrideData != NULL) {
Override = TxData->OverrideData; Override = TxData->OverrideData;
CopyMem (&Src, &Override->SourceAddress, sizeof (IP4_ADDR)); CopyMem (&Src, &Override->SourceAddress, sizeof (IP4_ADDR));
@ -1936,7 +1936,7 @@ EfiIp4Transmit (
CopyMem (&Head.Dst, &TxData->DestinationAddress, sizeof (IP4_ADDR)); CopyMem (&Head.Dst, &TxData->DestinationAddress, sizeof (IP4_ADDR));
Head.Dst = NTOHL (Head.Dst); Head.Dst = NTOHL (Head.Dst);
if (TxData->OverrideData) { if (TxData->OverrideData != NULL) {
Override = TxData->OverrideData; Override = TxData->OverrideData;
Head.Protocol = Override->Protocol; Head.Protocol = Override->Protocol;
Head.Tos = Override->TypeOfService; Head.Tos = Override->TypeOfService;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of Mtftp drivers. Implementation of Mtftp drivers.
Copyright (c) 2006 - 2009, Intel Corporation<BR> Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -286,6 +286,7 @@ Mtftp4DriverBindingStart (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
ASSERT (MtftpSb != NULL);
Status = gBS->SetTimer (MtftpSb->Timer, TimerPeriodic, TICKS_PER_SECOND); Status = gBS->SetTimer (MtftpSb->Timer, TimerPeriodic, TICKS_PER_SECOND);

View File

@ -1,7 +1,7 @@
/** @file /** @file
Routines to process MTFTP4 options. Routines to process MTFTP4 options.
Copyright (c) 2006 - 2009, Intel Corporation<BR> Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -525,6 +525,7 @@ Mtftp4ParseOptionOack (
if (EFI_ERROR (Status) || (Count == 0)) { if (EFI_ERROR (Status) || (Count == 0)) {
return Status; return Status;
} }
ASSERT (OptionList != NULL);
Status = Mtftp4ParseOption (OptionList, Count, FALSE, MtftpOption); Status = Mtftp4ParseOption (OptionList, Count, FALSE, MtftpOption);

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of driver entry point and driver binding protocol. Implementation of driver entry point and driver binding protocol.
Copyright (c) 2004 - 2009, Intel Corporation. <BR> Copyright (c) 2004 - 2010, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials are licensed All rights reserved. This program and the accompanying materials are licensed
and made available under the terms and conditions of the BSD License which and made available under the terms and conditions of the BSD License which
accompanies this distribution. The full text of the license may be found at accompanies this distribution. The full text of the license may be found at
@ -178,7 +178,7 @@ SimpleNetworkDriverSupported (
// //
// Check to see if !PXE structure is valid. Paragraph alignment of !PXE structure is required. // Check to see if !PXE structure is valid. Paragraph alignment of !PXE structure is required.
// //
if (NiiProtocol->Id & 0x0F) { if ((NiiProtocol->Id & 0x0F) != 0) {
DEBUG ((EFI_D_NET, "\n!PXE structure is not paragraph aligned.\n")); DEBUG ((EFI_D_NET, "\n!PXE structure is not paragraph aligned.\n"));
Status = EFI_UNSUPPORTED; Status = EFI_UNSUPPORTED;
goto Done; goto Done;
@ -615,7 +615,7 @@ SimpleNetworkDriverStart (
} }
if (Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) { if ((Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {
Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST; Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of collecting the statistics on a network interface. Implementation of collecting the statistics on a network interface.
Copyright (c) 2004 - 2007, Intel Corporation. <BR> Copyright (c) 2004 - 2010, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials are licensed All rights reserved. This program and the accompanying materials are licensed
and made available under the terms and conditions of the BSD License which and made available under the terms and conditions of the BSD License which
accompanies this distribution. The full text of the license may be found at accompanies this distribution. The full text of the license may be found at
@ -197,7 +197,7 @@ SnpUndi32Statistics (
break; break;
} }
if (Db->Supported & Mask) { if ((Db->Supported & Mask) != 0) {
*Stp = Db->Data[Index]; *Stp = Db->Data[Index];
Size = Index + 1; Size = Index + 1;
} else { } else {
@ -208,7 +208,7 @@ SnpUndi32Statistics (
// Compute size up to last supported statistic. // Compute size up to last supported statistic.
// //
while (++Index < 64) { while (++Index < 64) {
if (Db->Supported & (Mask = LShiftU64 (Mask, 1))) { if ((Db->Supported & (Mask = LShiftU64 (Mask, 1))) != 0) {
Size = Index; Size = Index;
} }
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Tcp request dispatcher implementation. Tcp request dispatcher implementation.
Copyright (c) 2005 - 2009, Intel Corporation<BR> Copyright (c) 2005 - 2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -532,15 +532,15 @@ Tcp4ConfigurePcb (
(UINT32) (Option->ConnectionTimeout * TCP_TICK_HZ) (UINT32) (Option->ConnectionTimeout * TCP_TICK_HZ)
); );
if (Option->EnableNagle == FALSE) { if (!Option->EnableNagle) {
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE); TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE);
} }
if (Option->EnableTimeStamp == FALSE) { if (!Option->EnableTimeStamp) {
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_TS); TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_TS);
} }
if (Option->EnableWindowScaling == FALSE) { if (!Option->EnableWindowScaling) {
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_WS); TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_WS);
} }
} }
@ -557,7 +557,7 @@ Tcp4ConfigurePcb (
// //
// update state of Tcb and socket // update state of Tcb and socket
// //
if (CfgData->AccessPoint.ActiveFlag == FALSE) { if (!CfgData->AccessPoint.ActiveFlag) {
TcpSetState (Tcb, TCP_LISTEN); TcpSetState (Tcb, TCP_LISTEN);
SockSetState (Sk, SO_LISTENING); SockSetState (Sk, SO_LISTENING);

View File

@ -1,7 +1,7 @@
/** @file /** @file
Support for PxeBc dhcp functions. Support for PxeBc dhcp functions.
Copyright (c) 2007 - 2009, Intel Corporation.<BR> Copyright (c) 2007 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -181,7 +181,7 @@ PxeBcParseCachedDhcpPacket (
// serverhostname option. // serverhostname option.
// //
Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD]; Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD];
if ((Option != NULL) && (Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE)) { if ((Option != NULL) && ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) != 0)) {
Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = PxeBcParseExtendOptions ( Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = PxeBcParseExtendOptions (
(UINT8 *) Offer->Dhcp4.Header.BootFileName, (UINT8 *) Offer->Dhcp4.Header.BootFileName,
@ -1754,7 +1754,7 @@ PxeBcSelectBootMenu (
gBS->Stall (10 * TICKS_PER_MS); gBS->Stall (10 * TICKS_PER_MS);
} }
if (!InputKey.ScanCode) { if (InputKey.ScanCode != 0) {
switch (InputKey.UnicodeChar) { switch (InputKey.UnicodeChar) {
case CTRL ('c'): case CTRL ('c'):
InputKey.ScanCode = SCAN_ESC; InputKey.ScanCode = SCAN_ESC;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Interface routines for PxeBc. Interface routines for PxeBc.
Copyright (c) 2007 - 2009, Intel Corporation.<BR> Copyright (c) 2007 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1407,20 +1407,20 @@ CheckIpByFilter (
} }
CopyMem (&DestIp4Address, &Session->DestinationAddress, sizeof (DestIp4Address)); CopyMem (&DestIp4Address, &Session->DestinationAddress, sizeof (DestIp4Address));
if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) && if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) != 0) &&
IP4_IS_MULTICAST (EFI_NTOHL (DestIp4Address)) IP4_IS_MULTICAST (EFI_NTOHL (DestIp4Address))
) { ) {
return TRUE; return TRUE;
} }
if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) && if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) != 0) &&
IP4_IS_LOCAL_BROADCAST (EFI_NTOHL (DestIp4Address)) IP4_IS_LOCAL_BROADCAST (EFI_NTOHL (DestIp4Address))
) { ) {
return TRUE; return TRUE;
} }
CopyMem (&Ip4Address, &PxeBcMode->StationIp.v4, sizeof (Ip4Address)); CopyMem (&Ip4Address, &PxeBcMode->StationIp.v4, sizeof (Ip4Address));
if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) && if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0) &&
EFI_IP4_EQUAL (&Ip4Address, &DestIp4Address) EFI_IP4_EQUAL (&Ip4Address, &DestIp4Address)
) { ) {
return TRUE; return TRUE;
@ -1784,7 +1784,7 @@ EfiPxeBcSetIpFilter (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) && if (NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) &&
(NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0)
) { ) {
// //
// If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IP4 address is in IpList, // If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IP4 address is in IpList,
@ -1803,8 +1803,8 @@ EfiPxeBcSetIpFilter (
Private->Udp4CfgData.AcceptBroadcast = FALSE; Private->Udp4CfgData.AcceptBroadcast = FALSE;
if (PromiscuousNeed || if (PromiscuousNeed ||
NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS || ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) != 0) ||
NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) != 0)
) { ) {
// //
// Configure the udp4 filter to receive all packages // Configure the udp4 filter to receive all packages
@ -1821,7 +1821,7 @@ EfiPxeBcSetIpFilter (
} else { } else {
if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) { if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) != 0) {
// //
// Configure the udp4 filter to receive all broadcast packages // Configure the udp4 filter to receive all broadcast packages
// //
@ -1836,7 +1836,7 @@ EfiPxeBcSetIpFilter (
return Status; return Status;
} }
if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) { if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0) {
for (Index = 0; Index < NewFilter->IpCnt; ++Index) { for (Index = 0; Index < NewFilter->IpCnt; ++Index) {
if (IP4_IS_MULTICAST (EFI_NTOHL (NewFilter->IpList[Index].v4))) { if (IP4_IS_MULTICAST (EFI_NTOHL (NewFilter->IpList[Index].v4))) {

View File

@ -1,7 +1,7 @@
/** @file /** @file
Support routines for PxeBc. Support routines for PxeBc.
Copyright (c) 2007 - 2009, Intel Corporation.<BR> Copyright (c) 2007 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. 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
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -97,6 +97,7 @@ GetSmbiosSystemGuidAndSerialNumber (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
ASSERT (SmbiosTable != NULL);
Smbios.Hdr = (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress; Smbios.Hdr = (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress;
SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength); SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength);

View File

@ -1,7 +1,7 @@
/** @file /** @file
HII Config Access protocol implementation of VLAN configuration module. HII Config Access protocol implementation of VLAN configuration module.
Copyright (c) 2009, Intel Corporation.<BR> Copyright (c) 2009 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions are licensed and made available under the terms and conditions
of the BSD License which accompanies this distribution. The full of the BSD License which accompanies this distribution. The full
@ -238,6 +238,7 @@ VlanCallback (
// //
// Remove VLAN // Remove VLAN
// //
ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);
for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) { for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {
if (Configuration->VlanList[Index] != 0) { if (Configuration->VlanList[Index] != 0) {
// //
@ -421,7 +422,7 @@ InstallVlanConfigForm (
EFI_STATUS Status; EFI_STATUS Status;
EFI_HII_HANDLE HiiHandle; EFI_HII_HANDLE HiiHandle;
EFI_HANDLE DriverHandle; EFI_HANDLE DriverHandle;
CHAR16 Str[40]; CHAR16 Str[26 + sizeof (EFI_MAC_ADDRESS) * 2 + 1];
CHAR16 *MacString; CHAR16 *MacString;
EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath; EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
@ -479,6 +480,7 @@ InstallVlanConfigForm (
PrivateData->MacString = MacString; PrivateData->MacString = MacString;
StrCpy (Str, L"VLAN Configuration (MAC:"); StrCpy (Str, L"VLAN Configuration (MAC:");
ASSERT (StrLen (MacString) <= (sizeof (EFI_MAC_ADDRESS) * 2));
StrCat (Str, MacString); StrCat (Str, MacString);
StrCat (Str, L")"); StrCat (Str, L")");
HiiSetString ( HiiSetString (