]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
Refine code to make it more safely.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiConfig.c
index 74ab8b8ed784b284ba390875f09cfbef4d06eb68..702f4f43cf61d4103325e963fc026d6f12c64b24 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -94,7 +94,7 @@ IScsiParseIsIdFromString (
   if (StrLen (IsIdStr) != 6) {\r
     UnicodeSPrint (\r
       PortString,\r
-      (UINTN) ISCSI_NAME_IFR_MAX_SIZE,\r
+      (UINTN) sizeof (PortString),\r
       L"Error! Input is incorrect, please input 6 hex numbers!\n"\r
       );\r
 \r
@@ -700,7 +700,7 @@ IScsiFormCallback (
       ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (QuestionId - KEY_DEVICE_ENTRY_BASE));\r
       ASSERT (ConfigFormEntry != NULL);\r
 \r
-      UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);\r
+      UnicodeSPrint (PortString, (UINTN) sizeof (PortString), L"Port %s", ConfigFormEntry->MacString);\r
       DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;\r
       HiiSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString, NULL);\r
 \r
@@ -1034,13 +1034,13 @@ IScsiConfigUpdateForm (
       //\r
       // Compose the Port string and create a new EFI_STRING_ID.\r
       //\r
-      UnicodeSPrint (PortString, 128, L"Port %s", ConfigFormEntry->MacString);\r
+      UnicodeSPrint (PortString, sizeof (PortString), L"Port %s", ConfigFormEntry->MacString);\r
       ConfigFormEntry->PortTitleToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);\r
 \r
       //\r
       // Compose the help string of this port and create a new EFI_STRING_ID.\r
       //\r
-      UnicodeSPrint (PortString, 128, L"Set the iSCSI parameters on port %s", ConfigFormEntry->MacString);\r
+      UnicodeSPrint (PortString, sizeof (PortString), L"Set the iSCSI parameters on port %s", ConfigFormEntry->MacString);\r
       ConfigFormEntry->PortTitleHelpToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);\r
 \r
       InsertTailList (&mIScsiConfigFormList, &ConfigFormEntry->Link);\r