[Libwebsockets] Segfault after doing lws_ring_insert

prelag at yahoo.com prelag at yahoo.com
Wed Aug 5 21:20:01 CEST 2020

Thank you sir!

Am I supposed to set msg->first and msg->final?  If so, what are those set to?


Paul R.

On Wednesday, August 5, 2020, 02:48:46 PM EDT, Andy Green <andy at warmcat.com> wrote: 

On 8/5/20 7:37 PM, prelag at yahoo.com wrote:
> Hello,
> Thanks in advance!  I know this is something simple I am overlooking.
> I have a test program based on the client echo example.  I am attempting to create a message and insert it into the ring_buffer to get picked up on the next LWS_CALLBACK_CLIENT_WRITEABLE.
> Here is my simple function that is called when a message is ready to be put in the buffer:
> void MyClass::sendResponse(string &response) {
>      syslog(LOG_DEBUG, "MyClass::sendResponse %s", response.c_str());
>      int len = strlen(response.c_str() + LWS_PRE);
>      msg3.payload = malloc(len);

You're writing beyond what you allocated-->

>      memcpy((char *) msg3.payload + LWS_PRE, response.c_str(), len);

None of that is any lws issue.


More information about the Libwebsockets mailing list