From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 BE78E201B0458 for ; Sat, 23 Feb 2019 01:41:57 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2019 01:41:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,403,1544515200"; d="scan'208";a="124599086" Received: from bfeng1-mobl1.ccr.corp.intel.com ([10.254.209.145]) by fmsmga007.fm.intel.com with ESMTP; 23 Feb 2019 01:41:55 -0800 From: "Feng, Bob C" To: edk2-devel@lists.01.org Cc: Bob Feng , Liming Gao Date: Sat, 23 Feb 2019 17:41:53 +0800 Message-Id: <20190223094153.29008-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 Subject: [Patch V2] 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: Sat, 23 Feb 2019 09:41:58 -0000 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c index 3907f44331..c5d79c89fa 100644 --- a/BaseTools/Source/C/Common/ParseInf.c +++ b/BaseTools/Source/C/Common/ParseInf.c @@ -506,11 +506,11 @@ Returns: Index = 0; // // Check input parameter // - if (AsciiString == NULL || ReturnValue == NULL) { + if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 0xFF) { return EFI_INVALID_PARAMETER; } while (AsciiString[Index] == ' ') { Index ++; } -- 2.18.0.windows.1