On Fri, 2019-10-18 at 15:27 +0200, Fabian Maurer wrote:
@@ -6011,6 +6015,20 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, case WS_IPPROTO_IP: switch(optname) {
case WS_IP_ADD_SOURCE_MEMBERSHIP:
case WS_IP_DROP_SOURCE_MEMBERSHIP:
case WS_IP_BLOCK_SOURCE:
case WS_IP_UNBLOCK_SOURCE:
{
/* ip_mreq_source is different on Windows, we need to switch source and interface */
struct ip_mreq_source * val = (void*)optval;
struct in_addr temp_addr = val->imr_sourceaddr;
val->imr_sourceaddr = val->imr_interface;
val->imr_interface = temp_addr;
You are modifying a structure owned by the caller. Look at how we build a local copy for WS_SO_LINGER, for example.