mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
7bf301dbc5
commit
da6b8feb22
|
@ -955,6 +955,7 @@ CheckPacket (
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINTN LastStep;
|
UINTN LastStep;
|
||||||
UINTN Step;
|
UINTN Step;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if ((NTOHS (Packet->OpCode)) != EFI_MTFTP4_OPCODE_DATA) {
|
if ((NTOHS (Packet->OpCode)) != EFI_MTFTP4_OPCODE_DATA) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -984,7 +985,10 @@ CheckPacket (
|
||||||
|
|
||||||
ShellPrintEx (-1, -1, L"%s", mTftpProgressDelete);
|
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++) {
|
for (Index = 1; Index < Step; Index++) {
|
||||||
Progress[Index] = L'=';
|
Progress[Index] = L'=';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue