]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Fix the ASSERT issue in Shell 'for' loop
authorQiu Shumin <shumin.qiu@intel.com>
Sun, 26 Jul 2015 08:06:01 +0000 (08:06 +0000)
committerjljusten <jljusten@Edk2>
Sun, 26 Jul 2015 08:06:01 +0000 (08:06 +0000)
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 <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
[lersek@redhat.com: updated commit message as requested by Jaben]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18059 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Application/Shell/ShellParametersProtocol.c

index de29c25ae8352ec89a6bdbffa57b0b339614376f..1c1367bdf89c0dc2c9c4910049b2bc82e5888260 100644 (file)
@@ -125,7 +125,7 @@ DEBUG_CODE_END();
     return (EFI_NOT_FOUND);\r
   }\r
 \r
-  StrnCpyS(*TempParameter, Length, (*Walker), NextDelim - *Walker);\r
+  StrnCpyS(*TempParameter, Length / sizeof(CHAR16), (*Walker), NextDelim - *Walker);\r
 \r
   //\r
   // Add a CHAR_NULL if we didnt get one via the copy\r