From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 694FD21D491B4 for ; Wed, 26 Jul 2017 18:41:25 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 26 Jul 2017 18:43:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,417,1496127600"; d="scan'208";a="1155825228" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by orsmga001.jf.intel.com with ESMTP; 26 Jul 2017 18:43:27 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: chenbo@pdx.edu, Liming Gao Date: Thu, 27 Jul 2017 09:42:28 +0800 Message-Id: <1501119752-3856-3-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 In-Reply-To: <1501119752-3856-1-git-send-email-yonghong.zhu@intel.com> References: <1501119752-3856-1-git-send-email-yonghong.zhu@intel.com> Subject: [Patch 2/6] BaseTools/GenSec: Fix a segmentation fault in main() 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: , X-List-Received-Date: Thu, 27 Jul 2017 01:41:25 -0000 Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=537 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/C/GenSec/GenSec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c index 9129b50..c0e4de2 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -1,9 +1,9 @@ /** @file Creates output file that is a properly formed section per the PI spec. -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -144,11 +144,11 @@ Returns: fprintf (stdout, "\nUsage: %s [options] [input_file]\n\n", UTILITY_NAME); // // Copyright declaration // - fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n"); + fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n"); // // Details Option // fprintf (stdout, "Options:\n"); @@ -1118,10 +1118,14 @@ Returns: argv += 2; continue; } if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--attributes") == 0)) { + if (argv[1] == NULL) { + Error (NULL, 0, 1003, "Invalid option value", "Guid section attributes can't be NULL"); + goto Finish; + } if (stricmp (argv[1], mGUIDedSectionAttribue[EFI_GUIDED_SECTION_PROCESSING_REQUIRED]) == 0) { SectGuidAttribute |= EFI_GUIDED_SECTION_PROCESSING_REQUIRED; } else if (stricmp (argv[1], mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]) == 0) { SectGuidAttribute |= EFI_GUIDED_SECTION_AUTH_STATUS_VALID; } else if (stricmp (argv[1], mGUIDedSectionAttribue[0]) == 0) { -- 2.6.1.windows.1