From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 EDCC681D17 for ; Fri, 28 Oct 2016 02:28:33 -0700 (PDT) Received: by mail-wm0-x229.google.com with SMTP id b80so84383193wme.1 for ; Fri, 28 Oct 2016 02:28:34 -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=O7uN+4Elq21EAtxxD+cAJ20UdD80WBDqPaZVKBRz67JM9sWpjVCleExdrkT+CRMiqI zLYtWFAPsgyYshwqJC6D9TOH/8aiVU5YblZav+ECP2dSrWS/dqcyJkz0rs/KMByRpQPv ypez/ssN01tOJZ61wVOikda8BJaKuIgwU1fA0= 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=FEhUorIJHILuQS1OIjq7umq5Xd3BFCgmjxGVEQ7s0cu+wTMrRg4y7dkY2rWkafgSOs /Mmgjy07osV3oKXjJbvqjms96WLjvLfWOAPYtRwY3FmupE5hhTXdveI2eY+bUb0U2wsm nf1xGNIwExpPhp6yJJbVPYnZCE/jFvBtjO6bcx4whJgrQPOAdOlAyA+Yi0kyOjyWKyNG clEjrXrcl20QcIZc1zPsxXuZLdFz54m1pvDtW+4lGZPmIKSwGjUI3jIiF8zDUg29hB45 0a2CDEaXiE8od6MufUmdBCSr5y6Lw5hNBtwREaQnJ7VV3aqOrHXD9M6m7aHH5sdC1E14 kyrA== X-Gm-Message-State: ABUngvc5dFEkrGNHVCswPJJqChiWwwcqHn76uWn0tZfLMLRRql+dzxLkyMxbTl3n3wBMfxLk X-Received: by 10.28.142.5 with SMTP id q5mr2813306wmd.72.1477646909741; Fri, 28 Oct 2016 02:28:29 -0700 (PDT) Received: from localhost.localdomain ([105.150.227.229]) by smtp.gmail.com with ESMTPSA id t129sm5074228wmg.23.2016.10.28.02.28.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Oct 2016 02:28:29 -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: Fri, 28 Oct 2016 10:28:13 +0100 Message-Id: <1477646896-21444-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477646896-21444-1-git-send-email-ard.biesheuvel@linaro.org> References: <1477646896-21444-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH v3 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: Fri, 28 Oct 2016 09:28:34 -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