/** @file\r
Helper functions for configuring or getting the parameters relating to iSCSI.\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, 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
);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
DeviceList = (ISCSI_DEVICE_LIST *) AllocatePool (DataSize);\r
+ ASSERT (DeviceList != NULL);\r
\r
gRT->GetVariable (\r
L"iSCSIDeviceList",\r
//\r
DeviceListSize = sizeof (ISCSI_DEVICE_LIST) + (NumHandles - 1) * sizeof (ISCSI_MAC_INFO);\r
DeviceList = (ISCSI_DEVICE_LIST *) AllocatePool (DeviceListSize);\r
+ ASSERT (DeviceList != NULL);\r
DeviceList->NumDevice = (UINT8) NumHandles;\r
\r
for (Index = 0; Index < NumHandles; Index++) {\r
if (EFI_ERROR (Status)) {\r
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid iSCSI Name!", NULL);\r
} else {\r
- AsciiStrCpy (Private->Current->SessionConfigData.TargetName, IScsiName);\r
+ AsciiStrCpyS (Private->Current->SessionConfigData.TargetName, ISCSI_NAME_MAX_SIZE, IScsiName);\r
}\r
\r
break;\r
Status = EFI_INVALID_PARAMETER;\r
break;\r
}\r
+\r
+ //\r
+ // Validate iSCSI target name configuration again:\r
+ // The format of iSCSI target name is already verified when user input the name;\r
+ // here we only check the case user does not input the name.\r
+ //\r
+ if (Private->Current->SessionConfigData.TargetName[0] == '\0') {\r
+ CreatePopUp (\r
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+ &Key,\r
+ L"iSCSI target name is NULL!",\r
+ NULL\r
+ );\r
+ Status = EFI_INVALID_PARAMETER;\r
+ break;\r
+ }\r
+\r
}\r
\r
if (IfrNvData->CHAPType != ISCSI_CHAP_NONE) {\r
CallbackInfo->RegisteredHandle = HiiAddPackages (\r
&gIp4IScsiConfigGuid,\r
CallbackInfo->DriverHandle,\r
- IScsiDxeStrings,\r
+ IScsi4DxeStrings,\r
IScsiConfigDxeBin,\r
NULL\r
);\r