summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-08-11 10:46:19 +0000
committerjsing <jsing@openbsd.org>2014-08-11 10:46:19 +0000
commit86baf547e7d3c1be4ff177e604a1d90b76725560 (patch)
treebaa06e392c0af585bc23da721e405a52e7855d39 /lib/libssl/ssl_lib.c
parentmissing memset in table_api.c (currently only used by pluggable tables) (diff)
downloadwireguard-openbsd-86baf547e7d3c1be4ff177e604a1d90b76725560.tar.xz
wireguard-openbsd-86baf547e7d3c1be4ff177e604a1d90b76725560.zip
Check the return value of sk_SSL_CIPHER_new_null(), since it allocates
memory and can return NULL. ok miod@
Diffstat (limited to 'lib/libssl/ssl_lib.c')
-rw-r--r--lib/libssl/ssl_lib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c
index b3f42102665..55ab469df5b 100644
--- a/lib/libssl/ssl_lib.c
+++ b/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_lib.c,v 1.80 2014/08/11 01:10:42 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.81 2014/08/11 10:46:19 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1417,10 +1417,12 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
return (NULL);
}
- if ((skp == NULL) || (*skp == NULL))
- sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */
- else {
- sk= *skp;
+ if (skp == NULL || *skp == NULL) {
+ sk = sk_SSL_CIPHER_new_null(); /* change perhaps later */
+ if (sk == NULL)
+ goto err;
+ } else {
+ sk = *skp;
sk_SSL_CIPHER_zero(sk);
}