diff options
author | 2014-07-13 11:15:54 +0000 | |
---|---|---|
committer | 2014-07-13 11:15:54 +0000 | |
commit | 441a66a022fb5f6be912b785bc4b99d7f10ac985 (patch) | |
tree | 8aaf1d5eed46fc36b0637e03b6387f6546bf94a4 | |
parent | EVP_DigestInit_ex() may be used to recycle an existing EVP_MD_CTX without having (diff) | |
download | wireguard-openbsd-441a66a022fb5f6be912b785bc4b99d7f10ac985.tar.xz wireguard-openbsd-441a66a022fb5f6be912b785bc4b99d7f10ac985.zip |
Check X509_NAME_oneline() return value when it will have to allocate memory.
-rw-r--r-- | lib/libcrypto/x509/x509_cmp.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/x509/x509_cmp.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/libcrypto/x509/x509_cmp.c b/lib/libcrypto/x509/x509_cmp.c index b63faaad2c8..e783683f3a2 100644 --- a/lib/libcrypto/x509/x509_cmp.c +++ b/lib/libcrypto/x509/x509_cmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_cmp.c,v 1.23 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: x509_cmp.c,v 1.24 2014/07/13 11:15:54 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -93,6 +93,8 @@ X509_issuer_and_serial_hash(X509 *a) EVP_MD_CTX_init(&ctx); f = X509_NAME_oneline(a->cert_info->issuer, NULL, 0); + if (f == NULL) + goto err; if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) goto err; if (!EVP_DigestUpdate(&ctx, (unsigned char *)f, strlen(f))) diff --git a/lib/libssl/src/crypto/x509/x509_cmp.c b/lib/libssl/src/crypto/x509/x509_cmp.c index b63faaad2c8..e783683f3a2 100644 --- a/lib/libssl/src/crypto/x509/x509_cmp.c +++ b/lib/libssl/src/crypto/x509/x509_cmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_cmp.c,v 1.23 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: x509_cmp.c,v 1.24 2014/07/13 11:15:54 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -93,6 +93,8 @@ X509_issuer_and_serial_hash(X509 *a) EVP_MD_CTX_init(&ctx); f = X509_NAME_oneline(a->cert_info->issuer, NULL, 0); + if (f == NULL) + goto err; if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) goto err; if (!EVP_DigestUpdate(&ctx, (unsigned char *)f, strlen(f))) |