Revision: 18608
          http://sourceforge.net/p/edk2/code/18608
Author:   shenshushi
Date:     2015-10-15 02:19:14 +0000 (Thu, 15 Oct 2015)
Log Message:
-----------
ShellPkg: Use safe string functions to refine 'Tftp.c' code.

Safe string functions can help avoid potential buffer overflow. This patch 
replaces the StrCpy with StCpyS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c

Modified: trunk/edk2/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c  2015-10-15 
01:04:08 UTC (rev 18607)
+++ trunk/edk2/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c  2015-10-15 
02:19:14 UTC (rev 18608)
@@ -955,6 +955,7 @@
   UINTN             Index;
   UINTN             LastStep;
   UINTN             Step;
+  EFI_STATUS        Status;
 
   if ((NTOHS (Packet->OpCode)) != EFI_MTFTP4_OPCODE_DATA) {
     return EFI_SUCCESS;
@@ -984,7 +985,10 @@
 
   ShellPrintEx (-1, -1, L"%s", mTftpProgressDelete);
 
-  StrCpy (Progress, mTftpProgressFrame);
+  Status = StrCpyS (Progress, TFTP_PROGRESS_MESSAGE_SIZE, mTftpProgressFrame);
+  if (EFI_ERROR(Status)) {
+    return Status;
+  }
   for (Index = 1; Index < Step; Index++) {
     Progress[Index] = L'=';
   }


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to