Browse Source

net: igmp: Avoid directly accessing address of unaligned struct

Use UNALIGNED_MEMBER_ADDR when getting the address of possibly
unaligned structures members instead of attempting to directly
get the address as an offset.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
pull/92325/merge
Alberto Escolar Piedras 1 week ago committed by Daniel DeGrasse
parent
commit
82658ea6b2
  1. 2
      subsys/net/ip/igmp.c

2
subsys/net/ip/igmp.c

@ -68,7 +68,7 @@ static int igmp_v2_create(struct net_pkt *pkt, const struct in_addr *addr, @@ -68,7 +68,7 @@ static int igmp_v2_create(struct net_pkt *pkt, const struct in_addr *addr,
igmp->type = type;
igmp->max_rsp = 0U;
net_ipaddr_copy(&igmp->address, addr);
net_ipaddr_copy(UNALIGNED_MEMBER_ADDR(igmp, address), addr);
igmp->chksum = 0;
if (net_pkt_set_data(pkt, &igmp_access)) {

Loading…
Cancel
Save