From patchwork Wed Oct 26 08:17:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 79359 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp284308qge; Wed, 26 Oct 2016 01:18:04 -0700 (PDT) X-Received: by 10.99.103.198 with SMTP id b189mr1558110pgc.81.1477469884638; Wed, 26 Oct 2016 01:18:04 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id sn6si1147711pab.23.2016.10.26.01.18.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 01:18:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 51FD71A1E92; Wed, 26 Oct 2016 01:18:02 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 845191A1E8C for ; Wed, 26 Oct 2016 01:18:00 -0700 (PDT) Received: by mail-wm0-x234.google.com with SMTP id d128so71697107wmf.1 for ; Wed, 26 Oct 2016 01:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K7Fg861LXuClSRGP7gJr8DHtQN6RvdPoz+5n3U3VwKA=; b=g8Hctj6Gl8HVBQCVeKHk+S2HWTvNlaopzIXUrk//uVjhGzerrFRe1muSKnkDAF/DNL LdhjcYmgD1qBWDYuMXZG6WoW5cD4bB2MU9VtEFBt2ch+OnhWCERp/mkmEKpR093jZ1JV fSQ7q7brIteWv7Yh05X65Dy42iUFp99kjWipw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K7Fg861LXuClSRGP7gJr8DHtQN6RvdPoz+5n3U3VwKA=; b=VklIuyCZKAH3v3CUuch9SZDRUwd6ecnBG4ItlD3G7h2Jx9yAv920gHV67s7rH5SFbM kbnFjM2mJFUm+gWrhq5MWyZ13mwXqx22zTqm9Kd0D6CiSySyhwAveQwMX802QwWVhK9r oL7IfliRmsTDO+Ey+bhEBjNl+lvw5ooBFus85kZlLSZBPs3rHm+vpkHKxQ+wx5dM40MK p9bZ6tb61DDjaT+zkoXWkbhvo4RljeprGvKKg8hGzPySJqo6PCJyILcsX9SDcrWSxQiL Cu58IGHxB83LvQysRF933BKqqrm2tgtYvftGXYnqnmCxoVVaR6Z/p4aIH5/CBWDsk735 nsWg== X-Gm-Message-State: ABUngvcQhk+GGnUQ4CQ2lYMyusCO9ZaMqZWGCg6xCdXpVDF+Vuw3bu8lpDbZjitN1DTFExaV X-Received: by 10.194.104.40 with SMTP id gb8mr1036146wjb.28.1477469879178; Wed, 26 Oct 2016 01:17:59 -0700 (PDT) Received: from localhost.localdomain ([105.150.227.229]) by smtp.gmail.com with ESMTPSA id y2sm1166640wjx.20.2016.10.26.01.17.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Oct 2016 01:17:58 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Wed, 26 Oct 2016 09:17:41 +0100 Message-Id: <1477469862-10046-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477469862-10046-1-git-send-email-ard.biesheuvel@linaro.org> References: <1477469862-10046-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 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: , Cc: ryan.harkin@linaro.org, lersek@redhat.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek 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,