summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-05-28 13:07:47 +0000
committerjsing <jsing@openbsd.org>2014-05-28 13:07:47 +0000
commitcdce7c5949509f0df5831dc71eb1a78f168b1b5a (patch)
treef56bf5e77ae5a627afb21143af1515337a5a56e2 /lib/libssl/ssl_lib.c
parentThere is no point in checking if a pointer is non-NULL before calling free, (diff)
downloadwireguard-openbsd-cdce7c5949509f0df5831dc71eb1a78f168b1b5a.tar.xz
wireguard-openbsd-cdce7c5949509f0df5831dc71eb1a78f168b1b5a.zip
EVP_MD_CTX_create() calls malloc and can return NULL. However, only one of
the calls in libssl actually checks the return value before using it. Add NULL checks for the remaining three calls. ok miod@
Diffstat (limited to 'lib/libssl/ssl_lib.c')
-rw-r--r--lib/libssl/ssl_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c
index bf983542941..12d45ea0251 100644
--- a/lib/libssl/ssl_lib.c
+++ b/lib/libssl/ssl_lib.c
@@ -3235,7 +3235,7 @@ ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
{
ssl_clear_hash_ctx(hash);
*hash = EVP_MD_CTX_create();
- if (md)
+ if (*hash != NULL && md != NULL)
EVP_DigestInit_ex(*hash, md, NULL);
return (*hash);
}