summaryrefslogtreecommitdiffstats
path: root/src/object.c
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2018-10-17 12:32:54 -0700
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-19 14:56:08 +0200
commitdc240913458d591f59b52b3899d3fc3c5d6ec6ce (patch)
treeb43acfe0306f2ab42a5f5abccc42420fe6a5508c /src/object.c
parentaecc936180d302947ecfab5dacf267a701a5d84c (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/object.c')
-rw-r--r--src/object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/object.c b/src/object.c
index a1a553f..e88203a 100644
--- a/src/object.c
+++ b/src/object.c
@@ -94,13 +94,13 @@ void nftnl_obj_set_data(struct nftnl_obj *obj, uint16_t attr,
return;
break;
case NFTNL_OBJ_FAMILY:
- obj->family = *((uint32_t *)data);
+ memcpy(&obj->family, data, sizeof(obj->family));
break;
case NFTNL_OBJ_USE:
- obj->use = *((uint32_t *)data);
+ memcpy(&obj->use, data, sizeof(obj->use));
break;
case NFTNL_OBJ_HANDLE:
- obj->handle = *((uint64_t *)data);
+ memcpy(&obj->handle, data, sizeof(obj->handle));
break;
default:
if (obj->ops)