Forgot to add the credit for this patch series as I didn't wrote this coccinelle script: Found using the memcpy-assign.cocci script submitted for inclusion into the Linux kernel: https://systeme.lip6.fr/pipermail/cocci/2013-January/000121.html
bye michael On 01/24/2013 02:21 PM, Michael Stefaniuc wrote: > --- > dlls/ws2_32/socket.c | 2 +- > dlls/ws2_32/tests/sock.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c > index c390828..6fd1e34 100644 > --- a/dlls/ws2_32/socket.c > +++ b/dlls/ws2_32/socket.c > @@ -2183,7 +2183,7 @@ static BOOL interface_bind( SOCKET s, int fd, struct > sockaddr *addr ) > > if (setsockopt(fd, IPPROTO_IP, IP_UNICAST_IF, &ifindex, > sizeof(ifindex)) != 0) > goto cleanup; /* Failed to suggest egress interface */ > - memcpy(&specific_interface_filter, &generic_interface_filter, > sizeof(generic_interface_filter)); > + specific_interface_filter = generic_interface_filter; > specific_interface_filter.iface_rule.k = adapter->Index; > filter_prog.len = sizeof(generic_interface_filter)/sizeof(struct > sock_filter); > filter_prog.filter = (struct sock_filter *) > &specific_interface_filter; > diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c > index 56a64bc..4b4b99a 100644 > --- a/dlls/ws2_32/tests/sock.c > +++ b/dlls/ws2_32/tests/sock.c > @@ -2725,7 +2725,7 @@ static void test_getsockname(void) > return; > } > > - memcpy(&sa_get, &sa_set, sizeof(sa_set)); > + sa_get = sa_set; > if (getsockname(sock, (struct sockaddr*) &sa_get, &sa_get_len) == 0) > ok(0, "getsockname on unbound socket should fail\n"); > else {