From patchwork Mon Oct 24 17:41:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 79021 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2703270qge; Mon, 24 Oct 2016 10:42:21 -0700 (PDT) X-Received: by 10.99.149.6 with SMTP id p6mr25721747pgd.21.1477330941418; Mon, 24 Oct 2016 10:42:21 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id qp8si13784097pac.89.2016.10.24.10.42.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 10:42:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; 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 198.145.21.10 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 99BC71A1E77; Mon, 24 Oct 2016 10:42:16 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 7F46C1A1E92 for ; Mon, 24 Oct 2016 10:42:14 -0700 (PDT) Received: by mail-wm0-x22d.google.com with SMTP id f193so135891370wmg.0 for ; Mon, 24 Oct 2016 10:42:14 -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=4Op/SQVM9fwS9MJ5+qH+Qb9QaXvlmLQBEvg1m+04wAw=; b=eALUOUNayuosPhzboLezlZbP3/rkt8NPXjnL5QrCNIGT/TED+nbDeasQMwAPG4//In PPButPVcKigmx58Y+7+7JmpNfKUAfA7qN/QInzXyESpCZtoDcKPGaamocAX8lp6GrJe9 eCXvTgs6jZ+rpJmc43HVNyJPM8XIOQXBOczJo= 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=4Op/SQVM9fwS9MJ5+qH+Qb9QaXvlmLQBEvg1m+04wAw=; b=jpuMh6mmIUA4TxrZIkSf8hgDTgpJPfR6kZ+Z59rFUzhx8S6D6pgExu6Wqk+mmRkM2T OpZuIW+Vhkt/fdjNTlPFrevZyUCtwF5IvQafRQys2H2Ci3Rsxzg4LSg5K39WEKlSZlfL b7Crmv1vCBDxD7Jdde/uUV+1RXzRvrYvO+DXQxyI0xnjXs3bhRrbOinAY0+Sz5KEafQN M4LYnjCQpYXpjRwq1pCsHfRf+Nhdm2VJsjnwfLwgMw1opKA1je1GcjFkag5J4wvcs0Gs abq+Yu7iImXIymQbnK0FmgXe7hAR1ektAVoRBuqEp3TzMdpJlhgkiGhRLF0EVsb5T97j xfHg== X-Gm-Message-State: ABUngvei9iG7egA6/I2/zEWBuqT/H5ZCZe2a6vvqoIDw4G5hbGrhPRKUWG41158uyWctUB7W X-Received: by 10.194.170.8 with SMTP id ai8mr16171932wjc.118.1477330933101; Mon, 24 Oct 2016 10:42:13 -0700 (PDT) Received: from localhost.localdomain ([105.146.229.54]) by smtp.gmail.com with ESMTPSA id 194sm15894873wmj.20.2016.10.24.10.42.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 10:42:12 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, lersek@redhat.com Date: Mon, 24 Oct 2016 18:41:43 +0100 Message-Id: <1477330907-13733-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477330907-13733-1-git-send-email-ard.biesheuvel@linaro.org> References: <1477330907-13733-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 5/9] EmbeddedPkg/AndroidFastboot: eliminate deprecated string function calls 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: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Get rid of calls to unsafe string functions. These are deprecated and may be removed in the future. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c | 3 ++- EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c index bbca90fc08a2..f3e770bcc980 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidBootImg.c @@ -84,7 +84,8 @@ ParseAndroidBootImg ( + ALIGN_VALUE (Header->KernelSize, Header->PageSize)); } - AsciiStrnCpy (KernelArgs, Header->KernelArgs, BOOTIMG_KERNEL_ARGS_SIZE); + AsciiStrnCpyS (KernelArgs, BOOTIMG_KERNEL_ARGS_SIZE, Header->KernelArgs, + BOOTIMG_KERNEL_ARGS_SIZE); return EFI_SUCCESS; } diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c index 9ddc34f57cf4..960218b25241 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c @@ -127,7 +127,7 @@ HandleDownload ( if (mDataBuffer == NULL) { SEND_LITERAL ("FAILNot enough memory"); } else { - AsciiStrnCpy (Response + 4, NumBytesString, 8); + AsciiStrnCpyS (Response + 4, mNumDataBytes, NumBytesString, 8); mTransport->Send (sizeof(Response), Response, &mFatalSendErrorEvent); mState = ExpectDataState; @@ -257,7 +257,7 @@ AcceptCmd ( } // Commands aren't null-terminated. Let's get a null-terminated version. - AsciiStrnCpy (Command, Data, Size); + AsciiStrnCpyS (Command, sizeof Command, Data, Size); Command[Size] = '\0'; // Parse command