Message ID | 1477646896-21444-6-git-send-email-ard.biesheuvel@linaro.org |
---|---|
State | Accepted |
Commit | 581b4ab93ff4853221063250fa22812a4121258e |
Headers | show |
On Fri, Oct 28, 2016 at 10:28:15AM +0100, Ard Biesheuvel wrote: > Remove calls to deprecated string functions like AsciiStrCpy() and > UnicodeStrToAsciiStr() > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Reviewed-by: Laszlo Ersek <lersek@redhat.com> > Tested-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> > --- > ArmPkg/Library/BdsLib/BdsFilePath.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c > index aefeaed4ffb5..f9d8c4c205bf 100644 > --- a/ArmPkg/Library/BdsLib/BdsFilePath.c > +++ b/ArmPkg/Library/BdsLib/BdsFilePath.c > @@ -964,7 +964,7 @@ Mtftp4CheckPacket ( > Step = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize; > if (Step > LastStep) { > Print (mTftpProgressDelete); > - StrCpy (Progress, mTftpProgressFrame); > + CopyMem (Progress, mTftpProgressFrame, sizeof mTftpProgressFrame); > for (Index = 1; Index < Step; Index++) { > Progress[Index] = L'='; > } > @@ -1044,6 +1044,7 @@ BdsTftpLoadImage ( > UINT64 FileSize; > UINT64 TftpBufferSize; > BDS_TFTP_CONTEXT *TftpContext; > + UINTN PathNameLen; > > ASSERT(IS_DEVICE_PATH_NODE (RemainingDevicePath, MESSAGING_DEVICE_PATH, MSG_IPv4_DP)); > IPv4DevicePathNode = (IPv4_DEVICE_PATH*)RemainingDevicePath; > @@ -1187,8 +1188,9 @@ BdsTftpLoadImage ( > > // The Device Path might contain multiple FilePath nodes > PathName = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL*)(IPv4DevicePathNode + 1), FALSE, FALSE); > - AsciiFilePath = AllocatePool (StrLen (PathName) + 1); > - UnicodeStrToAsciiStr (PathName, AsciiFilePath); > + PathNameLen = StrLen (PathName) + 1; > + AsciiFilePath = AllocatePool (PathNameLen); > + UnicodeStrToAsciiStrS (PathName, AsciiFilePath, PathNameLen); > > // > // Try to get the size of the file in bytes from the server. If it fails, > -- > 2.7.4 > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c index aefeaed4ffb5..f9d8c4c205bf 100644 --- a/ArmPkg/Library/BdsLib/BdsFilePath.c +++ b/ArmPkg/Library/BdsLib/BdsFilePath.c @@ -964,7 +964,7 @@ Mtftp4CheckPacket ( Step = (Context->DownloadedNbOfBytes * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize; if (Step > LastStep) { Print (mTftpProgressDelete); - StrCpy (Progress, mTftpProgressFrame); + CopyMem (Progress, mTftpProgressFrame, sizeof mTftpProgressFrame); for (Index = 1; Index < Step; Index++) { Progress[Index] = L'='; } @@ -1044,6 +1044,7 @@ BdsTftpLoadImage ( UINT64 FileSize; UINT64 TftpBufferSize; BDS_TFTP_CONTEXT *TftpContext; + UINTN PathNameLen; ASSERT(IS_DEVICE_PATH_NODE (RemainingDevicePath, MESSAGING_DEVICE_PATH, MSG_IPv4_DP)); IPv4DevicePathNode = (IPv4_DEVICE_PATH*)RemainingDevicePath; @@ -1187,8 +1188,9 @@ BdsTftpLoadImage ( // The Device Path might contain multiple FilePath nodes PathName = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL*)(IPv4DevicePathNode + 1), FALSE, FALSE); - AsciiFilePath = AllocatePool (StrLen (PathName) + 1); - UnicodeStrToAsciiStr (PathName, AsciiFilePath); + PathNameLen = StrLen (PathName) + 1; + AsciiFilePath = AllocatePool (PathNameLen); + UnicodeStrToAsciiStrS (PathName, AsciiFilePath, PathNameLen); // // Try to get the size of the file in bytes from the server. If it fails,