Revision: 19393
          http://sourceforge.net/p/edk2/code/19393
Author:   vanjeff
Date:     2015-12-18 07:28:26 +0000 (Fri, 18 Dec 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.

(Sync patch r18608 from main trunk.)

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

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

Modified Paths:
--------------
    branches/UDK2015/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c

Modified: branches/UDK2015/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
===================================================================
--- branches/UDK2015/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c    
2015-12-18 07:27:50 UTC (rev 19392)
+++ branches/UDK2015/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c    
2015-12-18 07:28:26 UTC (rev 19393)
@@ -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