public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Qin Long <qin.long@intel.com>
To: edk2-devel@lists.01.org
Cc: ting.ye@intel.com, lersek@redhat.com, hao.a.wu@intel.com,
	feng.tian@intel.com, eric.dong@intel.com
Subject: [Patch 3/4] CryptoPkg/BaseCryptLib: Adding NULL checking in timer() wrapper.
Date: Sat,  1 Apr 2017 01:05:16 +0800	[thread overview]
Message-ID: <20170331170517.4672-4-qin.long@intel.com> (raw)
In-Reply-To: <20170331170517.4672-1-qin.long@intel.com>

There are some explicit timer(NULL) calls in openssl-1.1.0xx source,
but the dummy timer() wrapper in ConstantTimeClock.c (used by PEI
and SMM module) has no any checks on NULL parameter. This will
cause the memory access issue.
This patch adds the NULL parameter checking in timer() wrapper.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
---
 CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c b/CryptoPkg/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, EITHER EXPRESS OR IMPLIED.
 
 time_t time (time_t *timer)
 {
-  *timer = 0;
-  return *timer;
+  if (timer != NULL) {
+    *timer = 0;
+  }
+  return 0;
 }
 
 struct tm * gmtime (const time_t *timer)
-- 
2.12.2.windows.1



  parent reply	other threads:[~2017-03-31 17:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 17:05 [Patch 0/4] *** Resolving CryptoPkg build issues *** Qin Long
2017-03-31 17:05 ` [Patch 1/4] CryptoPkg/OpensslLib: Suppress extra build warnings in openssl source Qin Long
2017-03-31 18:23   ` Laszlo Ersek
2017-04-01  1:10     ` Long, Qin
2017-03-31 17:05 ` [Patch 2/4] CryptoPkg: Fix possible unresolved external symbol issue Qin Long
2017-03-31 18:44   ` Laszlo Ersek
2017-04-01  2:31     ` Long, Qin
2017-03-31 17:05 ` Qin Long [this message]
2017-03-31 18:45   ` [Patch 3/4] CryptoPkg/BaseCryptLib: Adding NULL checking in timer() wrapper Laszlo Ersek
2017-04-01  2:14     ` Long, Qin
2017-03-31 17:05 ` [Patch 4/4] CryptoPkg: One workaround to resolve potential build issue Qin Long
2017-03-31 18:50   ` Laszlo Ersek
2017-04-01  2:27     ` Long, Qin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170331170517.4672-4-qin.long@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox