summaryrefslogtreecommitdiff
path: root/src/backend/libpq/be-secure.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2015-05-18 10:02:31 -0400
committerNoah Misch <noah@leadboat.com>2015-05-18 10:02:38 -0400
commit6675ab595ade396c43ff6c0ee7c99ccb5f0bc6f4 (patch)
treec7906b086e3158eda88cd1f00e2916429bde1921 /src/backend/libpq/be-secure.c
parentb584e45c9d9b70fba06ade7279763acf49e8af14 (diff)
Prevent a double free by not reentering be_tls_close().
Reentering this function with the right timing caused a double free, typically crashing the backend. By synchronizing a disconnection with the authentication timeout, an unauthenticated attacker could achieve this somewhat consistently. Call be_tls_close() solely from within proc_exit_prepare(). Back-patch to 9.0 (all supported versions). Benkocs Norbert Attila Security: CVE-2015-3165
Diffstat (limited to 'src/backend/libpq/be-secure.c')
-rw-r--r--src/backend/libpq/be-secure.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
index 6e094965057..6ddcfd8476f 100644
--- a/src/backend/libpq/be-secure.c
+++ b/src/backend/libpq/be-secure.c
@@ -906,7 +906,6 @@ open_server_SSL(Port *port)
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("could not initialize SSL connection: %s",
SSLerrmessage())));
- close_SSL(port);
return -1;
}
if (!my_SSL_set_fd(port->ssl, port->sock))
@@ -915,7 +914,6 @@ open_server_SSL(Port *port)
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("could not set SSL socket: %s",
SSLerrmessage())));
- close_SSL(port);
return -1;
}
@@ -963,7 +961,6 @@ aloop:
err)));
break;
}
- close_SSL(port);
return -1;
}
@@ -992,7 +989,6 @@ aloop:
{
/* shouldn't happen */
pfree(peer_cn);
- close_SSL(port);
return -1;
}
@@ -1006,7 +1002,6 @@ aloop:
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("SSL certificate's common name contains embedded null")));
pfree(peer_cn);
- close_SSL(port);
return -1;
}