[Libwebsockets] Segfault after doing lws_ring_insert
prelag at yahoo.com
prelag at yahoo.com
Fri Aug 7 03:51:50 CEST 2020
You da man!
On Wednesday, August 5, 2020, 05:02:28 PM EDT, Paweł Konowalski <pawel.konowalski.delta at gmail.com> wrote:
Paul,
Find the difference.
int len = strlen(response.c_str() + LWS_PRE);
vs
int len = strlen(response.c_str()) + LWS_PRE;
int len = response.length() + LWS_PRE;
BR
Paweł
W dniu 05.08.2020, śro o godzinie 19∶20 +0000, użytkownik
prelag at yahoo.com napisał:
> Thank you sir!
>
> Am I supposed to set msg->first and msg->final? If so, what are
> those set to?
>
> Thanks
>
> Paul R.
>
>
>
> On Wednesday, August 5, 2020, 02:48:46 PM EDT, Andy Green <andy at warmc
> at.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.
>
> -Andy
>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
More information about the Libwebsockets
mailing list