From nobody Sat Nov 2 12:21:44 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 1491025242340774.670462700401; Fri, 31 Mar 2017 22:40:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9C2A921DFA7A8; Fri, 31 Mar 2017 22:40:34 -0700 (PDT) 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 D24672063E06C for ; Fri, 31 Mar 2017 22:40:32 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 31 Mar 2017 22:40:32 -0700 Received: from shwde6388.ccr.corp.intel.com ([10.239.9.17]) by orsmga002.jf.intel.com with ESMTP; 31 Mar 2017 22:40:28 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,256,1486454400"; d="scan'208";a="67679635" From: Long Qin To: edk2-devel@lists.01.org Date: Sat, 1 Apr 2017 13:38:33 +0800 Message-Id: <20170401053834.12856-4-qin.long@intel.com> X-Mailer: git-send-email 2.12.2.windows.1 In-Reply-To: <20170401053834.12856-1-qin.long@intel.com> References: <20170401053834.12856-1-qin.long@intel.com> Subject: [edk2] [PATCH v2 3/4] CryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper. 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: feng.tian@intel.com, eric.dong@intel.com, ting.ye@intel.com, hao.a.wu@intel.com, Qin Long , lersek@redhat.com 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" From: Qin Long There are some explicit time(NULL) calls in openssl-1.1.0xx source, but the dummy time() wrapper in ConstantTimeClock.c (used by PEI and SMM module) has no any checks on NULL parameter. This is one bug and will cause the memory access issue. This patch adds the NULL parameter checking in time() wrapper. Cc: Ting Ye Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qin Long --- CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c b/C= ryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c index 7f20164999..0cd90434ca 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c @@ -31,8 +31,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHE= R EXPRESS OR IMPLIED. =20 time_t time (time_t *timer) { - *timer =3D 0; - return *timer; + if (timer !=3D NULL) { + *timer =3D 0; + } + return 0; } =20 struct tm * gmtime (const time_t *timer) --=20 2.12.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel