summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
112f4ad)
Add more NULL pointer checks before using them in DhGenerateKey and
Pkcs7GetCertificatesList functions to eliminate possible dereferenced
pointer issue.
Cc: Ting Ye <ting.ye@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
- BN_bn2bin (DhPubKey, PublicKey);\r
+ if (PublicKey != NULL) {\r
+ BN_bn2bin (DhPubKey, PublicKey);\r
+ }\r
*PublicKeySize = Size;\r
}\r
\r
*PublicKeySize = Size;\r
}\r
\r
}\r
}\r
CtxUntrusted = X509_STORE_CTX_get0_untrusted (CertCtx);\r
}\r
}\r
CtxUntrusted = X509_STORE_CTX_get0_untrusted (CertCtx);\r
- (VOID)sk_X509_delete_ptr (CtxUntrusted, Signer);\r
+ if (CtxUntrusted != NULL) {\r
+ (VOID)sk_X509_delete_ptr (CtxUntrusted, Signer);\r
+ }\r
\r
//\r
// Build certificates stack chained from Signer's certificate.\r
\r
//\r
// Build certificates stack chained from Signer's certificate.\r
}\r
sk_X509_free (Signers);\r
\r
}\r
sk_X509_free (Signers);\r
\r
- X509_STORE_CTX_cleanup (CertCtx);\r
- X509_STORE_CTX_free (CertCtx);\r
+ if (CertCtx != NULL) {\r
+ X509_STORE_CTX_cleanup (CertCtx);\r
+ X509_STORE_CTX_free (CertCtx);\r
+ }\r
\r
if (SingleCert != NULL) {\r
free (SingleCert);\r
\r
if (SingleCert != NULL) {\r
free (SingleCert);\r