Skip to content

Commit 82658ea

Browse files
aescolardanieldegrasse
authored andcommitted
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>
1 parent 236ccd3 commit 82658ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/ip/igmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static int igmp_v2_create(struct net_pkt *pkt, const struct in_addr *addr,
6868

6969
igmp->type = type;
7070
igmp->max_rsp = 0U;
71-
net_ipaddr_copy(&igmp->address, addr);
71+
net_ipaddr_copy(UNALIGNED_MEMBER_ADDR(igmp, address), addr);
7272
igmp->chksum = 0;
7373

7474
if (net_pkt_set_data(pkt, &igmp_access)) {

0 commit comments

Comments
 (0)