diff options
author | Fabian Hugelshofer <hugelshofer2006@gmx.ch> | 2008-06-18 14:24:57 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-06-18 14:24:57 +0200 |
commit | a47403d558f98368366116bf3aad8a6932671fc6 (patch) | |
tree | 8035e17d224c311484ec34da200a58095021d09d /src/expect | |
parent | 29ce47fc611015a64f66d1ec93c67a9d998f0592 (diff) |
Use union of char buffer and message header to ensure proper byte
alignment.
Signed-off-by: Fabian Hugelshofer <hugelshofer2006@gmx.ch>
Diffstat (limited to 'src/expect')
-rw-r--r-- | src/expect/api.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/expect/api.c b/src/expect/api.c index eefc294..ab804ca 100644 --- a/src/expect/api.c +++ b/src/expect/api.c @@ -507,16 +507,18 @@ int nfexp_query(struct nfct_handle *h, const void *data) { size_t size = 4096; /* enough for now */ - char buffer[4096]; - struct nfnlhdr *req = (struct nfnlhdr *) buffer; + union { + char buffer[size]; + struct nfnlhdr req; + } u; assert(h != NULL); assert(data != NULL); - if (nfexp_build_query(h->nfnlssh_exp, qt, data, req, size) == -1) + if (nfexp_build_query(h->nfnlssh_exp, qt, data, &u.req, size) == -1) return -1; - return nfnl_query(h->nfnlh, &req->nlh); + return nfnl_query(h->nfnlh, &u.req.nlh); } /** |