From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EA33C1A1E46 for ; Tue, 25 Oct 2016 04:16:52 -0700 (PDT) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67CA2883A4; Tue, 25 Oct 2016 11:16:52 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-71.phx2.redhat.com [10.3.116.71]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9PBGoNO031453; Tue, 25 Oct 2016 07:16:51 -0400 To: Ard Biesheuvel , edk2-devel@ml01.01.org, leif.lindholm@linaro.org References: <1477325206-24646-1-git-send-email-ard.biesheuvel@linaro.org> <1477325206-24646-6-git-send-email-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: Date: Tue, 25 Oct 2016 13:16:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1477325206-24646-6-git-send-email-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 25 Oct 2016 11:16:52 +0000 (UTC) Subject: Re: [PATCH 5/6] ArmPkg/BdsLib: eliminate calls to deprecated string functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2016 11:16:53 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 10/24/16 18:06, 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 > --- > 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..351a8bd8edf4 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); > + StrCpyS (Progress, sizeof (Progress), mTftpProgressFrame); > for (Index = 1; Index < Step; Index++) { > Progress[Index] = L'='; > } Same problem; please use CopyMem(), or introduce an ARRAY_SIZE() macro, and use that (which divides by the size of the element at offset zero). > @@ -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, > This hunk looks fine. Thanks Laszlo