cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl crash in setsockopt callback

From: Gisle Vanem <gvanem_at_yahoo.no>
Date: Sat, 12 Apr 2014 14:38:28 +0200

"Priyanka Shah" <priyanka_at_insiemenetworks.com> wrote:

> And this is the callback's implementation:
>
> int sockopt_callback(void *clientp, curl_socket_t curlfd, curlsocktype
> purpose)
> {
> if(clientp == NULL) {
> printf("error");
> return CURL_SOCKOPT_OK;
> }
>
> uint32_t data = *(uint32_t*) clientp;
> sock_ctx lSockCtx;
> memset(&lSockCtx, 0, sizeof(lSockCtx));
> lSockCtx.data = data;

Look like you got your pointer dereference wrong. Hence the crash.
How about:
      uint32_t data = (uint32_t) clientp;

But what's in this 'clientp' you pass in?

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-04-12