driver_wext.c memcpy problem

Dmitry Shmidt dimitrysh at google.com
Thu Apr 30 19:42:28 EDT 2009


Hi,

In driver_wext.c in function there is memcpy that has overlapping areas :
struct wpa_scan_results * wpa_driver_wext_get_scan_results(void *priv)
{
...
if (wext_19_iw_point(drv, iwe->cmd)) {
            /* WE-19 removed the pointer from struct iw_point */
            char *dpos = (char *) &iwe_buf.u.data.length;
            int dlen = dpos - (char *) &iwe_buf;
            os_memcpy(dpos, pos + IW_EV_LCP_LEN,   <<<<<<<<<<
                  sizeof(struct iw_event) - dlen);
        } else {
            os_memcpy(&iwe_buf, pos, sizeof(struct iw_event));
            custom += IW_EV_POINT_OFF;
        }
 ...
}

It didn't work for me so I needed to exchange it with memmove() call.
I am just curious how it worked for other people ? Is it possible that most
memcpy() lib functions know how to handle overlapping areas ?
Anyway it is not a mandatory memcpy() functionality.

Thanks,

Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20090430/5252e35d/attachment.htm 


More information about the HostAP mailing list