The 3rd parameter of 'GetNextParameter' is the buffer size in bytes. While 
StrnCpys requires user to pass the max number of dest unicode char, we should 
convert size in bytes to the number of char.

Cc: Jaben Carsey <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin<[email protected]>
---
 ShellPkg/Application/Shell/ShellParametersProtocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c 
b/ShellPkg/Application/Shell/ShellParametersProtocol.c
index de29c25..1c1367b 100644
--- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
@@ -125,7 +125,7 @@ DEBUG_CODE_END();
     return (EFI_NOT_FOUND);
   }
 
-  StrnCpyS(*TempParameter, Length, (*Walker), NextDelim - *Walker);
+  StrnCpyS(*TempParameter, Length / sizeof(CHAR16), (*Walker), NextDelim - 
*Walker);
 
   //
   // Add a CHAR_NULL if we didnt get one via the copy
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to