From nobody Fri Dec 27 18:19:47 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.zohomail.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 1501119798938195.30638283613678; Wed, 26 Jul 2017 18:43:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E2BB32095DB95; Wed, 26 Jul 2017 18:41:13 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 6AA8B21D491B4 for ; Wed, 26 Jul 2017 18:41:12 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2017 18:43:12 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by orsmga001.jf.intel.com with ESMTP; 26 Jul 2017 18:43:11 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,417,1496127600"; d="scan'208";a="1155825185" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Thu, 27 Jul 2017 09:42:27 +0800 Message-Id: <1501119752-3856-2-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: [edk2] [Patch 1/6] BaseTools/Split: Fix the segmentation fault in GetSplitValue() 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: chenbo@pdx.edu, Liming Gao 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" Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=3D538 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/C/Split/Split.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Sp= lit.c index 7ab66be..6b0a323 100644 --- a/BaseTools/Source/C/Split/Split.c +++ b/BaseTools/Source/C/Split/Split.c @@ -1,10 +1,10 @@ /** @file =20 Split a file into two pieces at the request offset. =20 -Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 1999 - 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 =20 @@ -78,11 +78,11 @@ Returns: GC_TODO: add return values =20 --*/ { Version(); - printf ("Copyright (c) 1999-2016 Intel Corporation. All rights reserved.= \n"); + printf ("Copyright (c) 1999-2017 Intel Corporation. All rights reserved.= \n"); printf ("\n SplitFile creates two Binary files either in the same direc= tory as the current working\n"); printf (" directory or in the specified directory.\n"); printf ("\nUsage: \n\ Split\n\ -f, --filename inputFile to split\n\ @@ -101,17 +101,21 @@ EFI_STATUS GetSplitValue ( IN CONST CHAR8* SplitValueString, OUT UINT64 *ReturnValue ) { - UINT64 len =3D strlen(SplitValueString); + UINT64 len =3D 0; UINT64 base =3D 1; UINT64 index =3D 0; UINT64 number =3D 0; CHAR8 lastCHAR =3D 0; EFI_STATUS Status =3D EFI_SUCCESS; =20 + if (SplitValueString !=3D NULL){ + len =3D strlen(SplitValueString); + } + if (len =3D=3D 0) { return EFI_ABORTED; } =20 Status =3D AsciiStringToUint64 (SplitValueString, FALSE, ReturnValue); --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel