[英]Unhandled Exception when using libcurl
I just finished my struggle with libcurl and finally when everything compiled just great I got an error when sending an email. 我刚刚完成与libcurl的斗争,最后,当一切编译都很好时,发送电子邮件时出现错误。 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 !http://wstaw.org/m/2011/08/22/error.png
And here's the code I'm using: http://pastebin.com/3BTA1fUW 这是我正在使用的代码: http : //pastebin.com/3BTA1fUW
EDIT: CODE + CALLSTACK: http://pastebin.com/DijJnYH0 编辑:代码+呼叫堆栈: http ://pastebin.com/DijJnYH0
Your payload_source
function is ignoring the size
and nmemb
parameters passed in. 您的
payload_source
函数将忽略传入的size
和nmemb
参数。
curl prepares a small buffer for you to write data into - the size of this buffer is given by size * nmemb
. curl为您准备了一个小的缓冲区以将数据写入其中-该缓冲区的大小由
size * nmemb
。 You cannot insert any more than size * nmemb
bytes; 插入的
size * nmemb
不能超过size * nmemb
个字节; 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. 因此,如果您的
strlen(data)
结果比size * nmemb
,那么您将写入太多数据并破坏堆。 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. 如果不能解决此问题,请提供其余代码以及堆栈跟踪的副本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.