Revision: 17821
          http://sourceforge.net/p/edk2/code/17821
Author:   shenshushi
Date:     2015-07-04 02:26:54 +0000 (Sat, 04 Jul 2015)
Log Message:
-----------
ShellPkg: Fix bug introduced by r17730.

CurrentFilePattern is only part of FilePattern and will be less than or equal 
to FilePattern. If we use StrCpyS to replace StrnCpy, it will cause assert when 
FilePattern is longer.
The bug can be replayed when we cd to one directory and run ls command.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi....@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
Reviewed-by: Qiu Shumin <shumin....@intel.com> 

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/17730

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c

Modified: trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2015-07-03 
07:27:31 UTC (rev 17820)
+++ trunk/edk2/ShellPkg/Application/Shell/ShellProtocol.c       2015-07-04 
02:26:54 UTC (rev 17821)
@@ -2220,7 +2220,7 @@
 
   CurrentFilePattern = 
AllocateZeroPool((NextFilePatternStart-FilePattern+1)*sizeof(CHAR16));
   ASSERT(CurrentFilePattern != NULL);
-  StrCpyS(CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern);
+  StrnCpyS(CurrentFilePattern, NextFilePatternStart-FilePattern+1, 
FilePattern, NextFilePatternStart-FilePattern);
 
   if (CurrentFilePattern[0]   == CHAR_NULL
     &&NextFilePatternStart[0] == CHAR_NULL


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to