From: Christian Grothoff Date: Wed, 27 Nov 2013 22:28:26 +0000 (+0100) Subject: curl_easy_getopt: Handle API violation gracefully X-Git-Tag: curl-7_34_0~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59f1209fadb6a32f7a957318d881185480580e91;p=thirdparty%2Fcurl.git 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. --- diff --git a/lib/getinfo.c b/lib/getinfo.c index 6a4e72e4a6..cd5a62ac0a 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))