]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/SnpDxe/ComponentName.c
MdeModulePkg/Mtftp4Dxe: Fix the incorrect return status.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / SnpDxe / ComponentName.c
index ef499d18cf6578b96d83e58636ca72edad72dfc8..d8b818401888d54186bdffc99f73ce3ab8dc7fe3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
     UEFI Component Name(2) protocol implementation for SnpDxe driver.\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed \r
 and made available under the terms and conditions of the BSD License which \r
 accompanies this distribution. The full text of the license may be found at \r
@@ -266,18 +266,19 @@ UpdateName (
   for (Index = 0; Index < Snp->Mode->HwAddressSize; Index++) {\r
     OffSet += UnicodeSPrint (\r
                 HandleName + OffSet,\r
-                sizeof (HandleName) - OffSet,\r
+                sizeof (HandleName) - OffSet * sizeof (CHAR16),\r
                 L"%02X-",\r
                 Snp->Mode->CurrentAddress.Addr[Index]\r
                 );\r
   }\r
+  ASSERT (OffSet > 0);\r
   //\r
   // Remove the last '-'\r
   //\r
   OffSet--;\r
   OffSet += UnicodeSPrint (\r
-              HandleName,\r
-              sizeof (HandleName),\r
+              HandleName + OffSet,\r
+              sizeof (HandleName) - OffSet * sizeof (CHAR16),\r
               L")"\r
               );\r
   if (gSimpleNetworkControllerNameTable != NULL) {\r