aboutsummaryrefslogtreecommitdiff
path: root/lib/getinfo.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-27 23:28:26 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-11-27 23:35:34 +0000
commit59f1209fadb6a32f7a957318d881185480580e91 (patch)
tree1fb4ea7aee82f349b771949dfa351c3986b520ee /lib/getinfo.c
parent7b9365c65f3228e1840d4abd507f03e3849817a1 (diff)
curl_easy_getopt: Handle API violation gracefully
This fixes a NULL dereference in the case where the client asks for CURLINFO_TLS_SESSION data after the (TLS) session has already been destroyed (i.e. curl_easy_perform has already completed for this handle). Instead of crashing, we now return a CURLSSLBACKEND_NONE error.
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r--lib/getinfo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 6a4e72e4a..cd5a62ac0 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -288,6 +288,9 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
tlsinfo->ssl_backend = CURLSSLBACKEND_NONE;
tlsinfo->internals = NULL;
+ if(!conn)
+ break;
+
/* Find the active ("in use") SSL connection, if any */
while((sockindex < sizeof(conn->ssl) / sizeof(conn->ssl[0])) &&
(!conn->ssl[sockindex].use))