]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c
Fix BDS boot from file . and .. fail assertion
[mirror_edk2.git] / EdkNt32Pkg / Dxe / PlatformBds / Generic / BootMaint / BootOption.c
index 13e82759e12d5bee532b22b0cd73b709d42f45cc..57b5239530c76876ff8ff8d08aafb88ee93e3ebc 100644 (file)
@@ -1055,6 +1055,27 @@ Returns:
   return MenuCount;\r
 }\r
 \r
   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
 CHAR16 *\r
 BOpt_AppendFileName (\r
   IN  CHAR16  *Str1,\r
@@ -1102,13 +1123,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
       // 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
       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
       Ptr = LastSlash;\r
     } else if (*Ptr == '\\') {\r
       LastSlash = Ptr;\r