NetworkPkg: Add check logic for iSCSI driver.

Need to check variable of mPrivate whether is
null before used and redefine the array length
of target address for keyword.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
Zhang, Lubo 2017-04-06 16:57:41 +08:00 committed by Jiaxin Wu
parent 861c8dff2f
commit b28bf4143d
2 changed files with 16 additions and 16 deletions

View File

@ -744,24 +744,24 @@ IScsiConvertAttemptConfigDataToIfrNvDataByKeyword (
}
}
CopyMem(IfrNvData->ISCSIDisplayAttemptList, AttemptNameList, ATTEMPT_NAME_LIST_SIZE);
}
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
IScsiMacAddrToStr (
&NicInfo->PermanentAddress,
NicInfo->HwAddressSize,
NicInfo->VlanId,
MacString
);
CopyMem (
IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr),
MacString,
StrLen (MacString) * sizeof (CHAR16)
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
IScsiMacAddrToStr (
&NicInfo->PermanentAddress,
NicInfo->HwAddressSize,
NicInfo->VlanId,
MacString
);
CopyMem (
IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr),
MacString,
StrLen (MacString) * sizeof (CHAR16)
);
*(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) = L'/';
}
*(IfrNvData->ISCSIMacAddr + StrLen (IfrNvData->ISCSIMacAddr)) = L'/';
}
}
}
/**

View File

@ -162,7 +162,7 @@ typedef struct {
CHAR16 ISCSIInitiatorNetmask[IP4_STR_MAX_SIZE];
CHAR16 ISCSIInitiatorGateway[IP4_STR_MAX_SIZE];
CHAR16 ISCSITargetName[ISCSI_NAME_MAX_SIZE];
CHAR16 ISCSITargetIpAddress[IP_STR_MAX_SIZE];
CHAR16 ISCSITargetIpAddress[ISCSI_TARGET_URI_MAX_SIZE];
CHAR16 ISCSILun[ISCSI_LUN_STR_MAX_LEN];
CHAR16 ISCSIChapUsername[ISCSI_CHAP_NAME_STORAGE];
CHAR16 ISCSIChapSecret[ISCSI_CHAP_SECRET_STORAGE];