netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft] json: fix type mismatch on "ct expect" json exporting
@ 2019-09-13 11:56 Fernando Fernandez Mancera
  2019-09-13 16:30 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Fernandez Mancera @ 2019-09-13 11:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Fernando Fernandez Mancera

The size field in ct_expect struct should be parsed as json integer and not as
a string. Also, l3proto field is parsed as string and not as an integer. That
was causing a segmentation fault when exporting "ct expect" objects as json.

Fixes: 1dd08fcfa07a ("src: add ct expectations support")
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
 src/json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/json.c b/src/json.c
index 55ce053..7aa4b69 100644
--- a/src/json.c
+++ b/src/json.c
@@ -333,7 +333,7 @@ static json_t *obj_print_json(const struct obj *obj)
 		json_decref(tmp);
 		break;
 	case NFT_OBJECT_CT_EXPECT:
-		tmp = json_pack("{s:o, s:I, s:I, s:s, s:I}",
+		tmp = json_pack("{s:o, s:I, s:I, s:I, s:s}",
 				"protocol",
 				proto_name_json(obj->ct_expect.l4proto),
 				"dport", obj->ct_expect.dport,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-13 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 11:56 [PATCH nft] json: fix type mismatch on "ct expect" json exporting Fernando Fernandez Mancera
2019-09-13 16:30 ` Pablo Neira Ayuso
2019-09-13 19:06   ` Stéphane Veyret

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).