From 4265849b0f1e5e2f65da6fea603b7b66a2c9fbc1 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 27 Apr 2020 18:54:02 +0100 Subject: [PATCH] ITS#9176 check for failure setting SNI --- libraries/libldap/tls_o.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/libldap/tls_o.c b/libraries/libldap/tls_o.c index 196134f6f4..e6f83c795d 100644 --- a/libraries/libldap/tls_o.c +++ b/libraries/libldap/tls_o.c @@ -531,7 +531,9 @@ tlso_session_connect( LDAP *ld, tls_session *sess, const char *name_in ) #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME if ( name_in ) { - SSL_set_tlsext_host_name( s, name_in ); + rc = SSL_set_tlsext_host_name( s, name_in ); + if ( !rc ) /* can fail to strdup the name */ + return -1; } #endif /* Caller expects 0 = success, OpenSSL returns 1 = success */