Fwd: truncated events from WPA supplicant

Ros Spolyak rostokus at gmail.com
Mon Sep 20 02:40:11 PDT 2021


Sorry for stupid question. You are right, "len" was not reset

пн, 20 вер. 2021 о 11:54 Johannes Berg <johannes at sipsolutions.net> пише:
>
> On Tue, 2021-09-14 at 22:33 +0300, Ros Spolyak wrote:
> > I have subscribed to WPA events in my application and often the
> > received events are truncated. The rest of the time events are
> > correct. Example,
> > <3>CTRL-EVENT-BSS-RE event received (len 20)
> > <3>CTRL-EVENT-DISCON event received (len 20)
> >
> > The code I am using:
> >   if (wpa_ctrl_pending(ctrl_conn_g) > 0) {
> >     char buf[256] = {0};
> >     size_t len = sizeof(buf) - 1;
> >
> >     while (wpa_ctrl_recv(ctrl_conn_g, buf, &len) == 0) {
> >       buf[len] = '\0';
> >       printf("'%s' event received (len %u)", buf, len);
>
> You need to reset 'len' for each loop iteration?
>
> johannes
>



More information about the Hostap mailing list