From nobody Sun May 5 03:19:31 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1498116275580298.04085789583553; Thu, 22 Jun 2017 00:24:35 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 48D2821CA3585; Thu, 22 Jun 2017 00:23:06 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E192F21C8F634 for ; Thu, 22 Jun 2017 00:23:04 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jun 2017 00:24:29 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.2]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2017 00:24:28 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,372,1493708400"; d="scan'208";a="870559871" From: Star Zeng To: edk2-devel@lists.01.org Date: Thu, 22 Jun 2017 15:24:25 +0800 Message-Id: <1498116265-150004-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [PATCH] ShellPkg DmpStore: Make NameSize to be consistent with name buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Jaben Carsey , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Current code will allocate pool to hold the null char for name buffer when PrevName=3D=3DNULL, but the NameSize is still 0. For this case, GetNextVariableName will return EFI_INVALID_PARAMETER to follow UEFI 2.7 spec. UEFI 2.7 spec: The VariableNameSize must not be smaller the size of the variable name string passed to GetNextVariableName() on input in the VariableName buffer. EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of the input VariableName buffer. This patch is to make NameSize to be consistent with name buffer. Cc: Ruiyu Ni Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Ruiyu Ni --- ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c b/Shell= Pkg/Library/UefiShellDebug1CommandsLib/DmpStore.c index 23db54553f11..aeffc89b1991 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c @@ -436,6 +436,7 @@ CascadeProcessVariables ( StrnCatGrow(&FoundVarName, &NameSize, PrevName, 0); } else { FoundVarName =3D AllocateZeroPool(sizeof(CHAR16)); + NameSize =3D sizeof(CHAR16); } =20 Status =3D gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarG= uid); --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel