diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2015-10-15 02:19:14 +0000 |
---|---|---|
committer | shenshushi <shenshushi@Edk2> | 2015-10-15 02:19:14 +0000 |
commit | da6b8feb223e6db3b13bcf1176eccca3ef450b30 (patch) | |
tree | 94204681908aae5d0157209e61c44043bbf11f20 /ShellPkg | |
parent | 7bf301dbc56d2e087ef54cc7b69199b17b3845da (diff) | |
download | edk2-da6b8feb223e6db3b13bcf1176eccca3ef450b30.zip edk2-da6b8feb223e6db3b13bcf1176eccca3ef450b30.tar.gz edk2-da6b8feb223e6db3b13bcf1176eccca3ef450b30.tar.bz2 |
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 <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18608 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c index 4bb21aa..02099fe 100644 --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c +++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c @@ -955,6 +955,7 @@ CheckPacket ( UINTN Index;
UINTN LastStep;
UINTN Step;
+ EFI_STATUS Status;
if ((NTOHS (Packet->OpCode)) != EFI_MTFTP4_OPCODE_DATA) {
return EFI_SUCCESS;
@@ -984,7 +985,10 @@ CheckPacket ( 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'=';
}
|