From d9d746ce5c9afdca0d67e4115c01343dd6ba8ddb Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 2 Dec 2014 10:52:03 -0800 Subject: [PATCH] common: avoid possible SSL_shutdown crash --- common/ssl_calls.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/common/ssl_calls.c b/common/ssl_calls.c index 966bbb15..99e9c50e 100644 --- a/common/ssl_calls.c +++ b/common/ssl_calls.c @@ -685,14 +685,24 @@ ssl_tls_accept(struct ssl_tls *self) } /*****************************************************************************/ +/* returns error, */ int APP_CC ssl_tls_disconnect(struct ssl_tls *self) { - int status = SSL_shutdown(self->ssl); + int status; + + if (self == NULL) + { + return 0; + } + if (self->ssl == NULL) + { + return 0; + } + status = SSL_shutdown(self->ssl); while (status != 1) { status = SSL_shutdown(self->ssl); - if (status <= 0) { if (ssl_tls_print_error("SSL_shutdown", self->ssl, status))