Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl_easy_getinfo with CURLINFO_TLS_SSL_PTR not able to get compiled #1524

gnanagurun opened this issue Jun 1, 2017 · 5 comments


Copy link

I did this

curl_easy_getinfo with CURLINFO_TLS_SSL_PTR gives compilation error - "call to '_curl_easy_getinfo_err_curl_slist' declared with attribute warning: curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info". I just passing the address of this variable struct curl_tlssessioninfo tls_ssl" to curl_easy_getinfo. To solve this compilation issue, i have tried to replace this with "struct curl_slist". Able to compile with this change but while running it gives segmentation fault even there is NULL checking in my code.

I expected the following

curl/libcurl version

libcurl version: 7.52.1 / OpenSSL version: 1.1.0d
[curl -V output]

operating system

Centos 6.5

Copy link

jay commented Jun 1, 2017

It looks like it has to do with the gcc typechecking. Since CURLINFO_TLS_SSL_PTR is internally treated categorized as slist type that may be why. But then if this is a problem I'm a little bit puzzled why nobody has ever reported it before.

The type should be struct curl_tlssessioninfo not struct curl_slist, What do you mean you tried to replace and what is segfaulting? Can you show the code?

Copy link

Below is the code snippet
// struct curl_tlssessioninfo *tls_ssl = NULL; commented out due to compilation issue
struct curl_slist *tls_ssl = NULL;
curl_easy_getinfo(curl_handle, CURLINFO_TLS_SSL_PTR, &tls_ssl);
if (tls_ssl && tls_ssl->data) // NULL checking
printf("tls_ssl ->data = %s\n", tls_ssl->data); // --> This is the place where segfault occur

Please let me know how to resolve the compilation issue when use "struct curl_tlssessioninfo"

Copy link

I don't think that tls_ssl->data is a NULL-terminated string. I'd guess that printf simply reads too much because of that and this is the cause of the segfault.

Copy link

This cannot be the cause of segfault. Even it occur if i just access the first character of tls_ssl->data[0]. It seems the type should be struct curl_tlssessioninfo. How to solve the compilation issue?

Copy link

bagder commented Jun 1, 2017

See #1525 for my suggested fix.

@bagder bagder added the build label Jun 1, 2017
@bagder bagder closed this as completed in 5fe4f78 Jun 1, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

No branches or pull requests

4 participants