]> granicus.if.org Git - strace/commitdiff
tests: fix unaligned access in nlattr_packet_diag_msg.test
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 4 Aug 2017 19:06:49 +0000 (19:06 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 4 Aug 2017 19:06:49 +0000 (19:06 +0000)
* tests/nlattr_packet_diag_msg.c (init_packet_diag_msg): Use SET_STRUCT
to initialize potentially unaligned struct packet_diag_msg.

tests/nlattr_packet_diag_msg.c

index a80c00c8f6f5aaa74e201b057cd8fd22b833c3f6..55b4144d7c5f6ece9d9ddd5f8e5f49b2dc7da888 100644 (file)
@@ -55,10 +55,10 @@ init_packet_diag_msg(struct nlmsghdr *const nlh, const unsigned int msg_len)
        );
 
        struct packet_diag_msg *const msg = NLMSG_DATA(nlh);
-       *msg = (struct packet_diag_msg) {
+       SET_STRUCT(struct packet_diag_msg, msg,
                .pdiag_family = AF_PACKET,
                .pdiag_type = SOCK_STREAM
-       };
+       );
 }
 
 static void