Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
gsocket: fix joining/leaving multicast groups
Browse files Browse the repository at this point in the history
Initialize the structure passed to setsockopt to 0 to avoid random
errors when joining or leaving a multicast group.

https://bugzilla.gnome.org/show_bug.cgi?id=688378
  • Loading branch information
Wim Taymans authored and danwinship committed Nov 15, 2012
1 parent 49db979 commit c2acbc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gio/gsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1952,6 +1952,7 @@ g_socket_multicast_group_operation (GSocket *socket,
struct ip_mreq mc_req;
#endif

memset (&mc_req, 0, sizeof (mc_req));
memcpy (&mc_req.imr_multiaddr, native_addr, sizeof (struct in_addr));

#ifdef HAVE_IP_MREQN
Expand Down Expand Up @@ -1985,6 +1986,7 @@ g_socket_multicast_group_operation (GSocket *socket,
{
struct ipv6_mreq mc_req_ipv6;

memset (&mc_req_ipv6, 0, sizeof (mc_req_ipv6));
memcpy (&mc_req_ipv6.ipv6mr_multiaddr, native_addr, sizeof (struct in6_addr));
#ifdef HAVE_IF_NAMETOINDEX
if (iface)
Expand Down

0 comments on commit c2acbc0

Please sign in to comment.