s_time: check return values better

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/12808)
This commit is contained in:
Pauli 2020-09-08 07:35:29 +10:00
parent e942111267
commit b7a8fb52a9
1 changed files with 11 additions and 4 deletions

View File

@ -416,12 +416,19 @@ static SSL *doConnection(SSL *scon, const char *host, SSL_CTX *ctx)
if ((conn = BIO_new(BIO_s_connect())) == NULL) if ((conn = BIO_new(BIO_s_connect())) == NULL)
return NULL; return NULL;
BIO_set_conn_hostname(conn, host); if (BIO_set_conn_hostname(conn, host) <= 0
BIO_set_conn_mode(conn, BIO_SOCK_NODELAY); || BIO_set_conn_mode(conn, BIO_SOCK_NODELAY) <= 0) {
BIO_free(conn);
return NULL;
}
if (scon == NULL) if (scon == NULL) {
serverCon = SSL_new(ctx); serverCon = SSL_new(ctx);
else { if (serverCon == NULL) {
BIO_free(conn);
return NULL;
}
} else {
serverCon = scon; serverCon = scon;
SSL_set_connect_state(serverCon); SSL_set_connect_state(serverCon);
} }