BIO socket connect failure was not handled correctly.
authorDavide Galassi <davide.galassi@gmail.com>
Mon, 18 Apr 2016 13:48:27 +0000 (15:48 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 20 Apr 2016 19:26:01 +0000 (21:26 +0200)
The state was always set to BIO_CONN_S_OK.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/bio/bss_conn.c

index a4949b3..c1abe87 100644 (file)
@@ -198,7 +198,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
             ret = BIO_connect(b->num, BIO_ADDRINFO_address(c->addr_iter),
                               BIO_SOCK_KEEPALIVE | c->connect_mode);
             b->retry_reason = 0;
-            if (ret < 0) {
+            if (ret == 0) {
                 if (BIO_sock_should_retry(ret)) {
                     BIO_set_retry_special(b);
                     c->state = BIO_CONN_S_BLOCKED_CONNECT;