From dc240913458d591f59b52b3899d3fc3c5d6ec6ce Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 17 Oct 2018 12:32:54 -0700 Subject: src: Use memcpy() to handle potentially unaligned data Rolf Eike Beer reported that nft-expr_quota-test fails with a SIGBUS on SPARC due to unaligned accesses. This patch resolves that and fixes additional sources of unaligned accesses matching the same pattern. Both nft-expr_quota-test and nft-expr_objref-test generated unaligned accesses on DEC Alpha. Bug: https://bugs.gentoo.org/666448 Signed-off-by: Matt Turner Signed-off-by: Pablo Neira Ayuso --- src/gen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gen.c') diff --git a/src/gen.c b/src/gen.c index 8e1a37a..1fc9099 100644 --- a/src/gen.c +++ b/src/gen.c @@ -73,7 +73,7 @@ int nftnl_gen_set_data(struct nftnl_gen *gen, uint16_t attr, switch (attr) { case NFTNL_GEN_ID: - gen->id = *((uint32_t *)data); + memcpy(&gen->id, data, sizeof(gen->id)); break; } gen->flags |= (1 << attr); -- cgit v1.2.3