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 <[email protected]> Cc: Fu Siyuan <[email protected]> Cc: Carsey Jaben <[email protected]> Cc: Zeng Star <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <[email protected]> --- ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c index c66be6b9d9..d4391b9f33 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c @@ -934,10 +934,12 @@ DownloadFile ( DOWNLOAD_CONTEXT *TftpContext; EFI_MTFTP4_TOKEN Mtftp4Token; UINT8 BlksizeBuf[10]; UINT8 WindowsizeBuf[10]; + ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); + // Downloaded file can be large. BS.AllocatePages() is more faster // than AllocatePool() and avoid fragmentation. // The downloaded file could be an EFI application. Marking the // allocated page as EfiBootServicesCode would allow to execute a // potential downloaded EFI application. @@ -959,11 +961,10 @@ DownloadFile ( } TftpContext->FileSize = FileSize; TftpContext->DownloadedNbOfBytes = 0; TftpContext->LastReportedNbOfBytes = 0; - ZeroMem (&Mtftp4Token, sizeof (EFI_MTFTP4_TOKEN)); Mtftp4Token.Filename = (UINT8*)AsciiFilePath; Mtftp4Token.BufferSize = FileSize; Mtftp4Token.Buffer = Buffer; Mtftp4Token.CheckPacket = CheckPacket; Mtftp4Token.Context = (VOID*)TftpContext; -- 2.17.1.windows.2 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

