]> git.proxmox.com Git - mirror_edk2.git/commitdiff
A short-term fix that StrCpy() needs to handle two overlapping strings.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Feb 2008 12:03:38 +0000 (12:03 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Feb 2008 12:03:38 +0000 (12:03 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4762 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/BdsDxe/BootMaint/BootOption.c

index 9a2273cfc408db217687a66f56330309f746fd51..661f2c9102b6f8dfecf43e346658f393c2da84a5 100644 (file)
@@ -1103,6 +1103,27 @@ Returns:
   return MenuCount;\r
 }\r
 \r
+CHAR16 *\r
+BdsStrCpy (\r
+  OUT     CHAR16                    *Destination,\r
+  IN      CONST CHAR16              *Source\r
+  )\r
+{\r
+  CHAR16                            *ReturnValue;\r
+\r
+  //\r
+  // Destination cannot be NULL\r
+  //\r
+  ASSERT (Destination != NULL);\r
+\r
+  ReturnValue = Destination;\r
+  while (*Source) {\r
+    *(Destination++) = *(Source++);\r
+  }\r
+  *Destination = 0;\r
+  return ReturnValue;\r
+}\r
+\r
 CHAR16 *\r
 BOpt_AppendFileName (\r
   IN  CHAR16  *Str1,\r
@@ -1150,13 +1171,13 @@ Returns:
       // DO NOT convert the .. if it is at the end of the string. This will\r
       // break the .. behavior in changing directories.\r
       //\r
-      StrCpy (LastSlash, Ptr + 3);\r
+      BdsStrCpy (LastSlash, Ptr + 3);\r
       Ptr = LastSlash;\r
     } else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {\r
       //\r
       // Convert a \.\ to a \\r
       //\r
-      StrCpy (Ptr, Ptr + 2);\r
+      BdsStrCpy (Ptr, Ptr + 2);\r
       Ptr = LastSlash;\r
     } else if (*Ptr == '\\') {\r
       LastSlash = Ptr;\r