From: Long Qin <qin.long@intel.com>
To: edk2-devel@lists.01.org
Cc: ting.ye@intel.com, hao.a.wu@intel.com, feng.tian@intel.com,
eric.dong@intel.com, lersek@redhat.com,
Qin Long <qin.long@intel.com>
Subject: [PATCH v2 3/4] CryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper.
Date: Sat, 1 Apr 2017 13:38:33 +0800 [thread overview]
Message-ID: <20170401053834.12856-4-qin.long@intel.com> (raw)
In-Reply-To: <20170401053834.12856-1-qin.long@intel.com>
From: Qin Long <qin.long@intel.com>
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 <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
next prev parent reply other threads:[~2017-04-01 5:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-01 5:38 [PATCH v2 0/4] Resolving Some CryptoPkg Build Issues Long Qin
2017-04-01 5:38 ` [PATCH v2 1/4] CryptoPkg/OpensslLib: Suppress extra build warnings in openssl source Long Qin
2017-04-01 5:38 ` [PATCH v2 2/4] CryptoPkg: Fix possible unresolved external symbol issue Long Qin
2017-04-01 5:38 ` Long Qin [this message]
2017-04-01 5:38 ` [PATCH v2 4/4] CryptoPkg: One workaround to resolve potential build issue Long Qin
2017-04-03 16:45 ` [PATCH v2 0/4] Resolving Some CryptoPkg Build Issues Laszlo Ersek
2017-04-06 8:54 ` Laszlo Ersek
2017-04-06 11:26 ` Long, Qin
2017-04-06 12:56 ` Laszlo Ersek
2017-04-06 14:17 ` Long, Qin
2017-04-06 17:17 ` Laszlo Ersek
2017-04-07 10:17 ` Laszlo Ersek
2017-04-07 13:22 ` 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=20170401053834.12856-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