diff options
author | Matt Caswell <matt@openssl.org> | 2015-05-09 13:51:25 +0800 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-05-11 11:54:10 +0100 |
commit | 6865dea2d657f75625fdd03408bac4408c660f5e (patch) | |
tree | 716f5cdeb857b4ef2a9374ea8c413ff5084794ee | |
parent | 76d0c6d48e5a42dedb24691a67d733f6859aee4d (diff) |
Check sk_SSL_CIPHER_new_null return value
If sk_SSL_CIPHER_new_null() returns NULL then ssl_bytes_to_cipher_list()
should also return NULL.
Based on an original patch by mrpre <mrpre@163.com>.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 14def5f5375594830597cc153e11c6017f6adddf)
-rw-r--r-- | ssl/ssl_lib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index dead126184..e11746a695 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1440,9 +1440,13 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); return (NULL); } - if ((skp == NULL) || (*skp == NULL)) + if ((skp == NULL) || (*skp == NULL)) { sk = sk_SSL_CIPHER_new_null(); /* change perhaps later */ - else { + if(sk == NULL) { + SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, ERR_R_MALLOC_FAILURE); + return NULL; + } + } else { sk = *skp; sk_SSL_CIPHER_zero(sk); } |