Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <Ouyang.qian@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13175
6f19259b-4bc3-4df7-8a09-
765794883524
/** @file\r
The assistant function implementation for IpSecConfig application.\r
\r
/** @file\r
The assistant function implementation for IpSecConfig application.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
//\r
// Convert falied, so use String->Integer map.\r
//\r
//\r
// Convert falied, so use String->Integer map.\r
//\r
+ ASSERT (Map != NULL);\r
Value64 = MapStringToInteger (ValueStr, Map);\r
if (Value64 == (UINT32) -1) {\r
//\r
Value64 = MapStringToInteger (ValueStr, Map);\r
if (Value64 == (UINT32) -1) {\r
//\r
/** @file\r
The implementation of policy entry operation function in IpSecConfig application.\r
\r
/** @file\r
The implementation of policy entry operation function in IpSecConfig application.\r
\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
if (ValueStr != NULL ) {\r
(*Data)->AlgoInfo.EspAlgoInfo.EncKeyLength = EncKeyLength;\r
AsciiStr = AllocateZeroPool (EncKeyLength + 1);\r
if (ValueStr != NULL ) {\r
(*Data)->AlgoInfo.EspAlgoInfo.EncKeyLength = EncKeyLength;\r
AsciiStr = AllocateZeroPool (EncKeyLength + 1);\r
+ ASSERT (AsciiStr != NULL);\r
UnicodeStrToAsciiStr (ValueStr, AsciiStr);\r
CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.EncKey, AsciiStr, EncKeyLength);\r
FreePool (AsciiStr);\r
UnicodeStrToAsciiStr (ValueStr, AsciiStr);\r
CopyMem ((*Data)->AlgoInfo.EspAlgoInfo.EncKey, AsciiStr, EncKeyLength);\r
FreePool (AsciiStr);\r
/** @file\r
This file is for Challenge-Handshake Authentication Protocol (CHAP) Configuration.\r
\r
/** @file\r
This file is for Challenge-Handshake Authentication Protocol (CHAP) Configuration.\r
\r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
Session = Conn->Session;\r
AuthData = &Session->AuthData.CHAP;\r
LoginReq = (ISCSI_LOGIN_REQUEST *) NetbufGetByte (Pdu, 0, 0);\r
Session = Conn->Session;\r
AuthData = &Session->AuthData.CHAP;\r
LoginReq = (ISCSI_LOGIN_REQUEST *) NetbufGetByte (Pdu, 0, 0);\r
+ if (LoginReq == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
Status = EFI_SUCCESS;\r
\r
RspLen = 2 * ISCSI_CHAP_RSP_LEN + 3;\r
Status = EFI_SUCCESS;\r
\r
RspLen = 2 * ISCSI_CHAP_RSP_LEN + 3;\r
/** @file\r
Helper functions for configuring or getting the parameters relating to iSCSI.\r
\r
/** @file\r
Helper functions for configuring or getting the parameters relating to iSCSI.\r
\r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+ ASSERT (StartOpCodeHandle != NULL);\r
\r
OptionsOpCodeHandle = NULL;\r
\r
\r
OptionsOpCodeHandle = NULL;\r
\r
/** @file\r
The implementation of iSCSI protocol based on RFC3720.\r
\r
/** @file\r
The implementation of iSCSI protocol based on RFC3720.\r
\r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+ ASSERT (Pdu != NULL);\r
+\r
//\r
// A Login Response is received; process it.\r
//\r
//\r
// A Login Response is received; process it.\r
//\r
the correspondence length fields are updated.\r
@retval EFI_OUT_OF_RESOURCES There is not enough space in the PDU to add the key-value\r
pair.\r
the correspondence length fields are updated.\r
@retval EFI_OUT_OF_RESOURCES There is not enough space in the PDU to add the key-value\r
pair.\r
+ @retval EFI_PROTOCOL_ERROR There is no such data in the net buffer.\r
**/\r
EFI_STATUS\r
IScsiAddKeyValuePair (\r
**/\r
EFI_STATUS\r
IScsiAddKeyValuePair (\r
CHAR8 *Data;\r
\r
LoginReq = (ISCSI_LOGIN_REQUEST *) NetbufGetByte (Pdu, 0, NULL);\r
CHAR8 *Data;\r
\r
LoginReq = (ISCSI_LOGIN_REQUEST *) NetbufGetByte (Pdu, 0, NULL);\r
+ if (LoginReq == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
DataSegLen = NTOH24 (LoginReq->DataSegmentLength);\r
\r
KeyLen = (UINT32) AsciiStrLen (Key);\r
DataSegLen = NTOH24 (LoginReq->DataSegmentLength);\r
\r
KeyLen = (UINT32) AsciiStrLen (Key);\r
Session = Conn->Session;\r
\r
LoginRsp = (ISCSI_LOGIN_RESPONSE *) NetbufGetByte (Pdu, 0, NULL);\r
Session = Conn->Session;\r
\r
LoginRsp = (ISCSI_LOGIN_RESPONSE *) NetbufGetByte (Pdu, 0, NULL);\r
+ if (LoginRsp == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
if (!ISCSI_CHECK_OPCODE (LoginRsp, ISCSI_OPCODE_LOGIN_RSP)) {\r
//\r
// It is not a Login Response.\r
if (!ISCSI_CHECK_OPCODE (LoginRsp, ISCSI_OPCODE_LOGIN_RSP)) {\r
//\r
// It is not a Login Response.\r
NET_BUF *DataOutPdu;\r
ISCSI_CONNECTION *Conn;\r
ISCSI_XFER_CONTEXT *XferContext;\r
NET_BUF *DataOutPdu;\r
ISCSI_CONNECTION *Conn;\r
ISCSI_XFER_CONTEXT *XferContext;\r
+ UINT8 *DataOutPacket;\r
\r
PduList = AllocatePool (sizeof (LIST_ENTRY));\r
if (PduList == NULL) {\r
\r
PduList = AllocatePool (sizeof (LIST_ENTRY));\r
if (PduList == NULL) {\r
//\r
// Set the F bit for the last data out PDU in this sequence.\r
//\r
//\r
// Set the F bit for the last data out PDU in this sequence.\r
//\r
- ISCSI_SET_FLAG (NetbufGetByte (DataOutPdu, 0, NULL), ISCSI_BHS_FLAG_FINAL);\r
+ DataOutPacket = NetbufGetByte (DataOutPdu, 0, NULL);\r
+ if (DataOutPacket == NULL) {\r
+ IScsiFreeNbufList (PduList);\r
+ PduList = NULL;\r
+ goto ON_EXIT;\r
+ }\r
+\r
+ ISCSI_SET_FLAG (DataOutPacket, ISCSI_BHS_FLAG_FINAL);\r
EFI_STATUS Status;\r
\r
DataInHdr = (ISCSI_SCSI_DATA_IN *) NetbufGetByte (Pdu, 0, NULL);\r
EFI_STATUS Status;\r
\r
DataInHdr = (ISCSI_SCSI_DATA_IN *) NetbufGetByte (Pdu, 0, NULL);\r
+ if (DataInHdr == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
\r
DataInHdr->InitiatorTaskTag = NTOHL (DataInHdr->InitiatorTaskTag);\r
DataInHdr->ExpCmdSN = NTOHL (DataInHdr->ExpCmdSN);\r
\r
DataInHdr->InitiatorTaskTag = NTOHL (DataInHdr->InitiatorTaskTag);\r
DataInHdr->ExpCmdSN = NTOHL (DataInHdr->ExpCmdSN);\r
UINT8 *Data;\r
\r
R2THdr = (ISCSI_READY_TO_TRANSFER *) NetbufGetByte (Pdu, 0, NULL);\r
UINT8 *Data;\r
\r
R2THdr = (ISCSI_READY_TO_TRANSFER *) NetbufGetByte (Pdu, 0, NULL);\r
+ if (R2THdr == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
\r
R2THdr->InitiatorTaskTag = NTOHL (R2THdr->InitiatorTaskTag);\r
R2THdr->TargetTransferTag = NTOHL (R2THdr->TargetTransferTag);\r
\r
R2THdr->InitiatorTaskTag = NTOHL (R2THdr->InitiatorTaskTag);\r
R2THdr->TargetTransferTag = NTOHL (R2THdr->TargetTransferTag);\r
UINT32 DataSegLen;\r
\r
ScsiRspHdr = (SCSI_RESPONSE *) NetbufGetByte (Pdu, 0, NULL);\r
UINT32 DataSegLen;\r
\r
ScsiRspHdr = (SCSI_RESPONSE *) NetbufGetByte (Pdu, 0, NULL);\r
+ if (ScsiRspHdr == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
\r
ScsiRspHdr->InitiatorTaskTag = NTOHL (ScsiRspHdr->InitiatorTaskTag);\r
if (ScsiRspHdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) {\r
\r
ScsiRspHdr->InitiatorTaskTag = NTOHL (ScsiRspHdr->InitiatorTaskTag);\r
if (ScsiRspHdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) {\r
DataSegLen = ISCSI_GET_DATASEG_LEN (ScsiRspHdr);\r
if (DataSegLen != 0) {\r
SenseData = (ISCSI_SENSE_DATA *) NetbufGetByte (Pdu, sizeof (SCSI_RESPONSE), NULL);\r
DataSegLen = ISCSI_GET_DATASEG_LEN (ScsiRspHdr);\r
if (DataSegLen != 0) {\r
SenseData = (ISCSI_SENSE_DATA *) NetbufGetByte (Pdu, sizeof (SCSI_RESPONSE), NULL);\r
+ if (SenseData == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
\r
SenseData->Length = NTOHS (SenseData->Length);\r
\r
\r
SenseData->Length = NTOHS (SenseData->Length);\r
\r
EFI_STATUS Status;\r
\r
NopInHdr = (ISCSI_NOP_IN *) NetbufGetByte (Pdu, 0, NULL);\r
EFI_STATUS Status;\r
\r
NopInHdr = (ISCSI_NOP_IN *) NetbufGetByte (Pdu, 0, NULL);\r
+ if (NopInHdr == NULL) {\r
+ return EFI_PROTOCOL_ERROR;\r
+ }\r
\r
NopInHdr->StatSN = NTOHL (NopInHdr->StatSN);\r
NopInHdr->ExpCmdSN = NTOHL (NopInHdr->ExpCmdSN);\r
\r
NopInHdr->StatSN = NTOHL (NopInHdr->StatSN);\r
NopInHdr->ExpCmdSN = NTOHL (NopInHdr->ExpCmdSN);\r
the Packet.\r
@retval EFI_DEVICE_ERROR Session state was not as required.\r
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
the Packet.\r
@retval EFI_DEVICE_ERROR Session state was not as required.\r
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.\r
+ @retval EFI_PROTOCOL_ERROR There is no such data in the net buffer.\r
@retval Others Other errors as indicated.\r
\r
**/\r
@retval Others Other errors as indicated.\r
\r
**/\r
\r
XferContext = &Tcb->XferContext;\r
PduHdr = NetbufGetByte (Pdu, 0, NULL);\r
\r
XferContext = &Tcb->XferContext;\r
PduHdr = NetbufGetByte (Pdu, 0, NULL);\r
+ if (PduHdr == NULL) {\r
+ Status = EFI_PROTOCOL_ERROR;\r
+ NetbufFree (Pdu);\r
+ goto ON_EXIT;\r
+ }\r
XferContext->Offset = ISCSI_GET_DATASEG_LEN (PduHdr);\r
\r
//\r
XferContext->Offset = ISCSI_GET_DATASEG_LEN (PduHdr);\r
\r
//\r
- switch (ISCSI_GET_OPCODE (NetbufGetByte (Pdu, 0, NULL))) {\r
+ PduHdr = NetbufGetByte (Pdu, 0, NULL);\r
+ if (PduHdr == NULL) {\r
+ Status = EFI_PROTOCOL_ERROR;\r
+ NetbufFree (Pdu);\r
+ goto ON_EXIT;\r
+ }\r
+ switch (ISCSI_GET_OPCODE (PduHdr)) {\r
case ISCSI_OPCODE_SCSI_DATA_IN:\r
Status = IScsiOnDataInRcvd (Pdu, Tcb, Packet);\r
break;\r
case ISCSI_OPCODE_SCSI_DATA_IN:\r
Status = IScsiOnDataInRcvd (Pdu, Tcb, Packet);\r
break;\r
/** @file\r
Mtftp6 Rrq process functions implementation.\r
\r
/** @file\r
Mtftp6 Rrq process functions implementation.\r
\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+ ASSERT (Options != NULL);\r
\r
//\r
// Parse the extensive options in the packet.\r
\r
//\r
// Parse the extensive options in the packet.\r
/** @file\r
Mtftp6 Wrq process functions implementation.\r
\r
/** @file\r
Mtftp6 Wrq process functions implementation.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+ ASSERT (Options != NULL);\r
\r
Status = Mtftp6ParseExtensionOption (Options, Count, FALSE, &ExtInfo);\r
\r
\r
Status = Mtftp6ParseExtensionOption (Options, Count, FALSE, &ExtInfo);\r
\r