Skip to contentSkip to conversation

json: fix type mismatch on "ct expect" json exporting

PATCH Applied Fernando Fernandez Mancera 3 participants 3 messages Sep 13, 2019 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 json: fix type mismatch on "ct expect" json exporting

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")
---
 src/json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/json.c +1 -1
index 55ce053..7aa4b69 100644
@@ -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,
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 3 lines · 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.

Applied, thanks Fernando.

#2 lore raw
Quoted 7 lines · Pablo Neira Ayuso
Quoted 3 lines · 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.

Applied, thanks Fernando.

Thanks. And sorry… I should have done it, but found no time until now.

Stéphane Veyret