From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (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 821DB1A1E86 for ; Wed, 26 Oct 2016 01:17:56 -0700 (PDT) Received: by mail-wm0-x22d.google.com with SMTP id 140so7384977wmv.0 for ; Wed, 26 Oct 2016 01:17:56 -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=0hA+ueqrJRvVDtXi71dkVI0ipWbWZZSxaSmFMcPBNT0=; b=NQBG72cTh5RITaAUMw+RMrG3LYmQKVFX9Szo2QBhP6sbzKUi6VAp1TGQRwOTFpgbE2 qX0YkcDUhuOftdXqQOtWRNpsyRW0D0gQdtTuxP/tpISzm8zaYeIeqXRVzOpCVAvl881u 37Sb79IvB+gqxu3ODs8kfkWhaCOYh3POqTHr4= 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=0hA+ueqrJRvVDtXi71dkVI0ipWbWZZSxaSmFMcPBNT0=; b=UyJul1GrJPA+NAypprNLFYwzpsM7x8J0+BiEIgAZY8tkdPXQ0rZH85vRC/IkPl8Gvv Z+j8ALb46V9sY0ByJ9fTK0hsWJ9+LbEFIN6VXd3jc+k8WKSp07PN3BCOXy/Eq/QHn/IN l046Ubdu1bGRto48/Ud6Nqn6ROL6Nxlg7KPwMZY7+jGRWdqhYgi2cxsxIUF22IjogWCp fDBlv302EMWhqXJyK8ybzgwimm5p51OWUFza4eHuD6HJvKONGpjDbnAIH2Zb2KkpA3Eg JKuRAHVRuFmljzSJQzfhSYdy8UuUNrquCEec6+MCzeiHJoYgQXpt9IrYf+oV3JVasYca 6wlA== X-Gm-Message-State: ABUngvfI+g3i0Sj3PfcmI3imDU426EsqnOYIDYfRag53OvZB5TYdDv0HLcKa4EphsZN7VuPb X-Received: by 10.194.220.232 with SMTP id pz8mr1157946wjc.154.1477469875141; Wed, 26 Oct 2016 01:17:55 -0700 (PDT) Received: from localhost.localdomain ([105.150.227.229]) by smtp.gmail.com with ESMTPSA id y2sm1166640wjx.20.2016.10.26.01.17.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Oct 2016 01:17:54 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Cc: lersek@redhat.com, ryan.harkin@linaro.org, Ard Biesheuvel Date: Wed, 26 Oct 2016 09:17:39 +0100 Message-Id: <1477469862-10046-4-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: [PATCH v2 3/6] ArmPkg/LinuxLoader: 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: Wed, 26 Oct 2016 08:17:56 -0000 Remove calls to deprecated string functions like AsciiStrCpy() and UnicodeStrToAsciiStr() Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Tested-by: Ryan Harkin Reviewed-by: Laszlo Ersek --- ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c | 2 +- ArmPkg/Application/LinuxLoader/LinuxLoader.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c b/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c index fd7ee9c8624d..0b3e2489c758 100644 --- a/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c +++ b/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c @@ -72,7 +72,7 @@ SetupCmdlineTag ( mLinuxKernelCurrentAtag->header.type = ATAG_CMDLINE; /* place CommandLine into tag */ - AsciiStrCpy (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, CmdLine); + AsciiStrCpyS (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, LineLength, CmdLine); // move pointer to next tag mLinuxKernelCurrentAtag = next_tag_address (mLinuxKernelCurrentAtag); diff --git a/ArmPkg/Application/LinuxLoader/LinuxLoader.c b/ArmPkg/Application/LinuxLoader/LinuxLoader.c index 70b960b66f0e..76697c3a8c9d 100644 --- a/ArmPkg/Application/LinuxLoader/LinuxLoader.c +++ b/ArmPkg/Application/LinuxLoader/LinuxLoader.c @@ -61,6 +61,7 @@ LinuxLoaderEntryPoint ( LIST_ENTRY *ResourceLink; SYSTEM_MEMORY_RESOURCE *Resource; EFI_PHYSICAL_ADDRESS SystemMemoryBase; + UINTN Length; Status = gBS->LocateProtocol ( &gEfiDevicePathFromTextProtocolGuid, @@ -182,12 +183,13 @@ LinuxLoaderEntryPoint ( } if (LinuxCommandLine != NULL) { - AsciiLinuxCommandLine = AllocatePool ((StrLen (LinuxCommandLine) + 1) * sizeof (CHAR8)); + Length = StrLen (LinuxCommandLine) + 1; + AsciiLinuxCommandLine = AllocatePool (Length); if (AsciiLinuxCommandLine == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Error; } - UnicodeStrToAsciiStr (LinuxCommandLine, AsciiLinuxCommandLine); + UnicodeStrToAsciiStrS (LinuxCommandLine, AsciiLinuxCommandLine, Length); } // -- 2.7.4