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 3F13B1A1E73 for ; Mon, 24 Oct 2016 09:07:05 -0700 (PDT) Received: by mail-wm0-x22d.google.com with SMTP id c78so111954866wme.0 for ; Mon, 24 Oct 2016 09:07:05 -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=rqdsmIecXp61ZCFrRK7PPKmBLSwy8AWXTNdncVkVIe4=; b=LwHpccYe9xylEMS1+XFwwnGnvHr4K0vwIb3LADhEgqc53sgMTQkloYm+LfzGzAwHTW cYGNR96VeS6z0Z37xWmu3QHRGVSqHRqucT3lCnOwUZJS1EFo5p4WykhmzRlVVTLgUKxU 61CrfJpFk/PmC2IovofW1kj1VsaEfQrIITaSw= 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=rqdsmIecXp61ZCFrRK7PPKmBLSwy8AWXTNdncVkVIe4=; b=msXembUtSFxK/dFtRFTT8TMCc+ucoDS81BVXMMlL5mEHsTqjHuSNG/XgNMv9JywRHR ux1lFEStJJJnQIZngzvxUFLC5gnDd0PW4IpwYqN9zoT2/YbdyHiT9bvp11YEPP0QRBy1 lENhDWl6cC2W9EYqnBUKobnQZV27Jl40lNf1rvLEmlhss9vG5LFEtR+Crlsgz6iMTAaC U2WZEUyI6D4NTP+1nA+D78FPjzIDJTTV9jQUJ/s1wDj+VgmvEToQ7i0zNwoZrH6wzn0T 4l9NXp2OEC2IsSXHhhgcvBpz8SOZopnYCD+4eON/Z4WiNsrRhxhEM2ZBl20W0EimDyQB 66Pg== X-Gm-Message-State: AA6/9RlvUND725qdDw34kXYJ/2RigF3bvksSg4mZ2TI06CSjRZ38KcFL6n2nLnfHon5pYRGB X-Received: by 10.28.27.143 with SMTP id b137mr16903736wmb.82.1477325223810; Mon, 24 Oct 2016 09:07:03 -0700 (PDT) Received: from localhost.localdomain ([105.146.229.54]) by smtp.gmail.com with ESMTPSA id h3sm20055144wjp.45.2016.10.24.09.07.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 09:07:03 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, lersek@redhat.com Cc: Ard Biesheuvel Date: Mon, 24 Oct 2016 17:06:43 +0100 Message-Id: <1477325206-24646-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477325206-24646-1-git-send-email-ard.biesheuvel@linaro.org> References: <1477325206-24646-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH 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: Mon, 24 Oct 2016 16:07:05 -0000 Remove calls to deprecated string functions like AsciiStrCpy() and UnicodeStrToAsciiStr() Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- 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