Revision: 17747
          http://sourceforge.net/p/edk2/code/17747
Author:   shenshushi
Date:     2015-06-30 20:15:15 +0000 (Tue, 30 Jun 2015)
Log Message:
-----------
ShellPkg: Refine code to make catenae length more precise.

This commit refine the catenae length. A too long catenae length in StrnCat may 
cause potential buffer overflow while in StrnCatS it may ASSERT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin....@intel.com>
Reviewed-by: Jaben Carsey <jaben.car...@intel.com>

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

Modified: trunk/edk2/ShellPkg/Application/Shell/FileHandleWrappers.c
===================================================================
--- trunk/edk2/ShellPkg/Application/Shell/FileHandleWrappers.c  2015-06-30 
06:31:28 UTC (rev 17746)
+++ trunk/edk2/ShellPkg/Application/Shell/FileHandleWrappers.c  2015-06-30 
20:15:15 UTC (rev 17747)
@@ -516,11 +516,11 @@
             StrnCatS( TabStr, 
                       (*BufferSize)/sizeof(CHAR16), 
                       CurrentString + TabPos, 
-                      (StringLen - TabPos) * sizeof (CHAR16)
+                      StringLen - TabPos
                       );
           } else {
             *TabStr = CHAR_NULL;
-            StrnCatS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + 
TabPos, (StringLen - TabPos) * sizeof (CHAR16));
+            StrnCatS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + 
TabPos, StringLen - TabPos);
           }
         } else {
           StrCpyS(TabStr, (*BufferSize)/sizeof(CHAR16), CurrentString + 
TabPos);


------------------------------------------------------------------------------
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