diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-07-01 09:27:19 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-07-01 09:27:19 +0000 |
commit | edc93a319184294dfa2f1764baceb02f49ccdcc5 (patch) | |
tree | 1904eb4615771127aeaab60dbb782314f642cf7f /ArmPkg/Library | |
parent | a6217114e35fd10215513d8b026bd4e0c3770814 (diff) | |
download | edk2-platforms-edc93a319184294dfa2f1764baceb02f49ccdcc5.tar.xz |
ArmPkg/BdsLib: Prevent memory leak whith TFTP
In some case, the size of the downloaded TFTP image cannot be known.
An arbitrary larger buffer is allocated to receive the image.
We need to make sure when we free the buffer we free the size
of the allocated buffer and not the size of the actual image.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15609 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Library')
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsFilePath.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c index f3fa445655..411fcc1fcc 100644 --- a/ArmPkg/Library/BdsLib/BdsFilePath.c +++ b/ArmPkg/Library/BdsLib/BdsFilePath.c @@ -756,6 +756,7 @@ BdsTftpLoadImage ( EFI_STATUS Status;
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
UINT64 TftpBufferSize;
+ UINT64 TftpTransferSize;
EFI_IP_ADDRESS ServerIp;
IPv4_DEVICE_PATH* IPv4DevicePathNode;
FILEPATH_DEVICE_PATH* FilePathDevicePath;
@@ -857,12 +858,13 @@ BdsTftpLoadImage ( goto EXIT;
}
+ TftpTransferSize = TftpBufferSize;
Status = Pxe->Mtftp (
Pxe,
EFI_PXE_BASE_CODE_TFTP_READ_FILE,
(VOID *)(UINTN)*Image,
FALSE,
- &TftpBufferSize,
+ &TftpTransferSize,
NULL,
&ServerIp,
(UINT8*)AsciiPathName,
|