]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg/BaseCryptLib: Adding NULL checking in time() wrapper.
authorQin Long <qin.long@intel.com>
Fri, 31 Mar 2017 14:12:45 +0000 (22:12 +0800)
committerQin Long <qin.long@intel.com>
Thu, 6 Apr 2017 16:28:56 +0000 (00:28 +0800)
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>
CryptoPkg/Library/BaseCryptLib/SysCall/ConstantTimeClock.c

index 7f20164999f35496d2968bf17abf73080e0cfa8a..0cd90434ca61c6aacfa76561fe54a0be0bba761a 100644 (file)
@@ -31,8 +31,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 time_t time (time_t *timer)\r
 {\r
-  *timer = 0;\r
-  return *timer;\r
+  if (timer != NULL) {\r
+    *timer = 0;\r
+  }\r
+  return 0;\r
 }\r
 \r
 struct tm * gmtime (const time_t *timer)\r