From b0f81b62def9fa06b0eae9d7a6e9659e20c4afe7 Mon Sep 17 00:00:00 2001 From: Qiu Shumin Date: Sun, 26 Jul 2015 08:06:01 +0000 Subject: ShellPkg: Fix the ASSERT issue in Shell 'for' loop The Length 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin Reviewed-by: Jaben Carsey [lersek@redhat.com: updated commit message as requested by Jaben] Signed-off-by: Laszlo Ersek git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18059 6f19259b-4bc3-4df7-8a09-765794883524 --- 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 de29c25ae8..1c1367bdf8 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 -- cgit v1.2.3