]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ShellEnvVar.c
ShellPkg: Use safe string functions to refine code.
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellEnvVar.c
index de09174c624d6b0c736993ca4f3e48d7ca55cefc..8ed14b34a2f48992c0ae3a2b29c53f54d18615af 100644 (file)
@@ -339,7 +339,10 @@ SetEnvironmentVariables(
     //\r
     // Copy the string into the Key, leaving the last character allocated as NULL to terminate\r
     //\r
-    StrnCpy(Node->Key, CurrentString, StrStr(CurrentString, L"=") - CurrentString);\r
+    StrCpyS( Node->Key, \r
+              StrStr(CurrentString, L"=") - CurrentString + 1, \r
+              CurrentString\r
+              );\r
 \r
     //\r
     // ValueSize = TotalSize - already removed size - size for '=' + size for terminator (the last 2 items cancel each other)\r