diff options
author | Matt Turner <mattst88@gmail.com> | 2018-10-17 12:32:54 -0700 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-10-19 14:56:08 +0200 |
commit | dc240913458d591f59b52b3899d3fc3c5d6ec6ce (patch) | |
tree | b43acfe0306f2ab42a5f5abccc42420fe6a5508c /src/obj/counter.c | |
parent | aecc936180d302947ecfab5dacf267a701a5d84c (diff) |
src: Use memcpy() to handle potentially unaligned data
Rolf Eike Beer <eike@sf-mail.de> 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 <mattst88@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/obj/counter.c')
-rw-r--r-- | src/obj/counter.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/obj/counter.c b/src/obj/counter.c index 23b60c5..1baba4e 100644 --- a/src/obj/counter.c +++ b/src/obj/counter.c @@ -29,10 +29,10 @@ nftnl_obj_counter_set(struct nftnl_obj *e, uint16_t type, switch(type) { case NFTNL_OBJ_CTR_BYTES: - ctr->bytes = *((uint64_t *)data); + memcpy(&ctr->bytes, data, sizeof(ctr->bytes)); break; case NFTNL_OBJ_CTR_PKTS: - ctr->pkts = *((uint64_t *)data); + memcpy(&ctr->pkts, data, sizeof(ctr->pkts)); break; default: return -1; |