CryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper.

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>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Qin Long 2017-03-31 22:12:45 +08:00
parent 5d7a1d63c0
commit 7c410b3d41
1 changed files with 4 additions and 2 deletions

View File

@ -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)