CryptoPkg/BaseCryptLib: Add NULL pointer checks in DH and P7Verify

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>
(cherry picked from commit a9fb7b7803)
This commit is contained in:
Long Qin
2017-05-19 15:22:10 +08:00
parent 3ecfa5668f
commit 454d99de04
2 changed files with 10 additions and 4 deletions

View File

@ -232,7 +232,9 @@ DhGenerateKey (
return FALSE;
}
BN_bn2bin (DhPubKey, PublicKey);
if (PublicKey != NULL) {
BN_bn2bin (DhPubKey, PublicKey);
}
*PublicKeySize = Size;
}