curl-users
Re: problem when using curlopts_writefunction
Date: Thu, 09 Jan 2014 13:27:30 -0500
The library is now just giving me wrong information about the amount of
data read in.
output is:
RTSP: SETUP rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov/trackID=1
TRANSPORT RTP/AVP;unicast;client_port=1234-1235
*****Made it into our magic function!
wtf, size; 17, nmemb: 140735181538536, charcounts: 2392498086155112
curl_easy_perform(curl) failed: 23
I've annotated my paste with the latest code I'm running. I'm watching
the packets in wireshark and I'm definitely not getting responses this
large.
http://paste.lisp.org/+30O6/2
even if I assume I've been given any data, attempting to access memory
at ptr fails. gdb has this to say
rtsp::RtspClient::sdp_parse (this=0x1b0000001c03, ptr=0x1 <Address 0x1
out of bounds>, size=2392498086155112, nmemb=140735181538536,
userdata=0x10048761c) at rtspclient.cpp:490
490 memmove(parseme, ptr, 10);
code that ran is appended to the annotation, available here:
http://paste.lisp.org/+30O6/3
I'm using cURL V7.33.0 loaded on osx 10.7.5
?
On 1/9/14 7:43 AM, Gisle Vanem wrote:
> "Joshua Kordani" <jkordani_at_lsa2.com> wrote:
>
>> I am attempting to use the function in the below paste as a
>> curlopts_writefunction. Ignoring that the sscanf will probably
>> always fail, I am receiving errors when trying to access the data
>> behind the pointer passed in by the function. I'm assuming that
>> nmemb represents the number of bytes (where the byte size is
>> represented by the size param), and so if I am going to treat them
>> like ascii text, am I doing my calculations correct? The runtime is
>> telling me, no. Please help!
>>
>> http://paste.lisp.org/+30O6/1
>
> You'll have to return the "number of bytes actually taken care of" (quote
> from the man-page). So do a:
> return (charcounts);
>
>> memmove(parseme, ptr, charcounts);
>
> You could use memcpy() since memmove() takes care of overlapping data.
> But 'ptr' and 'parseme' will never overlap. And:
> > char parseme[1024];
>
> should be increated to CURL_MAX_WRITE_SIZE (16k).
>
> --gv
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-users
> FAQ: http://curl.haxx.se/docs/faq.html
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-- Joshua Kordani LSA Autonomy
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-09