All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [nft PATCH 08/15] ct: Fix ct label value parser
Date: Wed, 24 Nov 2021 18:22:44 +0100	[thread overview]
Message-ID: <20211124172251.11539-9-phil@nwl.cc> (raw)
In-Reply-To: <20211124172251.11539-1-phil@nwl.cc>

Size of array to export the bit value into was eight times too large, so
on Big Endian the data written into the data reg was always zero.

Fixes: 2fcce8b0677b3 ("ct: connlabel matching support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/ct.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/ct.c b/src/ct.c
index 2218ecc7a684d..6049157198ad9 100644
--- a/src/ct.c
+++ b/src/ct.c
@@ -176,7 +176,7 @@ static struct error_record *ct_label_type_parse(struct parse_ctx *ctx,
 {
 	const struct symbolic_constant *s;
 	const struct datatype *dtype;
-	uint8_t data[CT_LABEL_BIT_SIZE];
+	uint8_t data[CT_LABEL_BIT_SIZE / BITS_PER_BYTE];
 	uint64_t bit;
 	mpz_t value;
 
@@ -211,8 +211,7 @@ static struct error_record *ct_label_type_parse(struct parse_ctx *ctx,
 	mpz_export_data(data, value, BYTEORDER_HOST_ENDIAN, sizeof(data));
 
 	*res = constant_expr_alloc(&sym->location, dtype,
-				   dtype->byteorder, sizeof(data),
-				   data);
+				   dtype->byteorder, CT_LABEL_BIT_SIZE, data);
 	mpz_clear(value);
 	return NULL;
 }
-- 
2.33.0


  parent reply	other threads:[~2021-11-24 17:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 17:22 [nft PATCH 00/15] Fix netlink debug output on Big Endian Phil Sutter
2021-11-24 17:22 ` [nft PATCH 01/15] tests/py: Avoid duplicate records in *.got files Phil Sutter
2021-11-24 17:22 ` [nft PATCH 02/15] exthdr: Fix for segfault with unknown exthdr Phil Sutter
2021-11-24 17:22 ` [nft PATCH 03/15] mnl: Fix for missing info in rule dumps Phil Sutter
2021-11-24 17:22 ` [nft PATCH 04/15] src: Fix payload statement mask on Big Endian Phil Sutter
2021-11-24 17:22 ` [nft PATCH 05/15] meta: Fix {g,u}id_type " Phil Sutter
2021-11-24 17:22 ` [nft PATCH 06/15] meta: Fix hour_type size Phil Sutter
2021-11-24 17:22 ` [nft PATCH 07/15] datatype: Fix size of time_type Phil Sutter
2021-11-24 17:22 ` Phil Sutter [this message]
2021-11-24 17:22 ` [nft PATCH 09/15] netlink_delinearize: Fix for escaped asterisk strings on Big Endian Phil Sutter
2021-11-24 17:22 ` [nft PATCH 10/15] Make string-based data types " Phil Sutter
2021-11-24 17:22 ` [nft PATCH 11/15] evaluate: Fix key byteorder value in range sets/maps Phil Sutter
2021-11-24 17:22 ` [nft PATCH 12/15] include: Use struct nftnl_set_desc Phil Sutter
2021-11-24 17:22 ` [nft PATCH 13/15] mnl: Provide libnftnl with set element meta info when dumping Phil Sutter
2021-11-24 17:22 ` [nft PATCH 14/15] tests/py/tools: Add regen_payloads.sh Phil Sutter
2021-11-30 13:47 ` [nft PATCH 00/15] Fix netlink debug output on Big Endian Pablo Neira Ayuso
2021-11-30 13:55   ` Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211124172251.11539-9-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.