I just finished my struggle with libcurl and finally when everything compiled just great I got an error when sending an email. I copied the code from an example and just changed to my server port/login/password.
Here's the error screenshot:
!http://wstaw.org/m/2011/08/22/error.png
And here's the code 开发者_如何学运维I'm using: http://pastebin.com/3BTA1fUW
EDIT: CODE + CALLSTACK: http://pastebin.com/DijJnYH0
Your payload_source
function is ignoring the size
and nmemb
parameters passed in.
curl prepares a small buffer for you to write data into - the size of this buffer is given by size * nmemb
. You cannot insert any more than size * nmemb
bytes; you have to wait for the next call. So if your strlen(data)
turns out something longer than size * nmemb
, you write too much data and corrupt the heap. This can result in the crash you have shown.
If fixing this does not fix your problem, please provide the rest of your code, and a copy of the stack trace.
精彩评论