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 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 Cc: Ard Biesheuvel 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: [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: , X-List-Received-Date: Mon, 24 Oct 2016 17:42:14 -0000 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(-) 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 -- 2.7.4