ShellPkg/TftpDynamicCommand: Fix the potentially uninitialized local variable used.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1217

Local variable 'Mtftp4Token' might be uninitialized when error happen. This patch is to
resolve the issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Carsey Jaben <jaben.carsey@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Jiaxin Wu 2018-09-27 18:43:23 +08:00
parent cf320090fa
commit 61d3f1000e
1 changed files with 2 additions and 1 deletions

View File

@ -936,6 +936,8 @@ DownloadFile (
UINT8 BlksizeBuf[10]; UINT8 BlksizeBuf[10];
UINT8 WindowsizeBuf[10]; UINT8 WindowsizeBuf[10];
ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN));
// Downloaded file can be large. BS.AllocatePages() is more faster // Downloaded file can be large. BS.AllocatePages() is more faster
// than AllocatePool() and avoid fragmentation. // than AllocatePool() and avoid fragmentation.
// The downloaded file could be an EFI application. Marking the // The downloaded file could be an EFI application. Marking the
@ -961,7 +963,6 @@ DownloadFile (
TftpContext->DownloadedNbOfBytes = 0; TftpContext->DownloadedNbOfBytes = 0;
TftpContext->LastReportedNbOfBytes = 0; TftpContext->LastReportedNbOfBytes = 0;
ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN));
Mtftp4Token.Filename = (UINT8*)AsciiFilePath; Mtftp4Token.Filename = (UINT8*)AsciiFilePath;
Mtftp4Token.BufferSize = FileSize; Mtftp4Token.BufferSize = FileSize;
Mtftp4Token.Buffer = Buffer; Mtftp4Token.Buffer = Buffer;