From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 58654201B0437 for ; Fri, 22 Feb 2019 02:05:06 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Feb 2019 02:05:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,399,1544515200"; d="scan'208";a="301714612" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga005.jf.intel.com with ESMTP; 22 Feb 2019 02:05:04 -0800 From: "Feng, Bob C" To: edk2-devel@lists.01.org Cc: Bob Feng , Liming Gao Date: Fri, 22 Feb 2019 18:05:02 +0800 Message-Id: <20190222100502.10332-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Subject: [Patch] BaseTools: Add parameter check for the AsciiStringToUint64 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 10:05:06 -0000 Content-Transfer-Encoding: 8bit If the input parameter AsciiString length is greater than 255, the GenFv will hang. This patch is to fix this issue. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao --- BaseTools/Source/C/Common/ParseInf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c index 3907f44331..b29f4c2f93 100644 --- a/BaseTools/Source/C/Common/ParseInf.c +++ b/BaseTools/Source/C/Common/ParseInf.c @@ -493,11 +493,11 @@ Returns: EFI_SUCCESS Number successfully converted. EFI_ABORTED Invalid character encountered. --*/ { - UINT8 Index; + UINT32 Index; UINT64 Value; CHAR8 CurrentChar; // // Initialize the result @@ -506,11 +506,11 @@ Returns: Index = 0; // // Check input parameter // - if (AsciiString == NULL || ReturnValue == NULL) { + if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 0xFFFFFFFF) { return EFI_INVALID_PARAMETER; } while (AsciiString[Index] == ' ') { Index ++; } -- 2.20.1.windows.1