summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_clnt.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2018-05-13 17:31:06 +0000
committerjsing <jsing@openbsd.org>2018-05-13 17:31:06 +0000
commit1cfb9855501a088d5c041bb1e573833c1fea698b (patch)
tree458e76faba08d349432e0da3a4f5d5d61fdad74c /lib/libssl/ssl_clnt.c
parentReference the related accessor EVP_PKEY_get0_asn1(3). (diff)
downloadwireguard-openbsd-1cfb9855501a088d5c041bb1e573833c1fea698b.tar.xz
wireguard-openbsd-1cfb9855501a088d5c041bb1e573833c1fea698b.zip
Fix a malloc() NULL check in ssl3_send_client_kex_ecdhe_ecp(), by adding
the missing goto. While here also remove a set of unnecessary parentheses.
Diffstat (limited to 'lib/libssl/ssl_clnt.c')
-rw-r--r--lib/libssl/ssl_clnt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libssl/ssl_clnt.c b/lib/libssl/ssl_clnt.c
index 0ecbae46950..e189c82fdd2 100644
--- a/lib/libssl/ssl_clnt.c
+++ b/lib/libssl/ssl_clnt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_clnt.c,v 1.24 2018/04/07 16:55:13 jsing Exp $ */
+/* $OpenBSD: ssl_clnt.c,v 1.25 2018/05/13 17:31:06 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -2113,7 +2113,7 @@ ssl3_send_client_kex_ecdhe_ecp(SSL *s, SESS_CERT *sc, CBB *cbb)
}
/* Generate a new ECDH key pair. */
- if (!(EC_KEY_generate_key(ecdh))) {
+ if (!EC_KEY_generate_key(ecdh)) {
SSLerror(s, ERR_R_ECDH_LIB);
goto err;
}
@@ -2123,6 +2123,7 @@ ssl3_send_client_kex_ecdhe_ecp(SSL *s, SESS_CERT *sc, CBB *cbb)
}
if ((key = malloc(key_size)) == NULL) {
SSLerror(s, ERR_R_MALLOC_FAILURE);
+ goto err;
}
key_len = ECDH_compute_key(key, key_size, point, ecdh, NULL);
if (key_len <= 0) {