netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libnftables PATCH v2 1/2] rule: json: Fixed wrong offset return
@ 2013-09-24 12:54 Alvaro Neira
  2013-09-24 12:54 ` [libnftables PATCH v2 2/2] This patch adds a ruleset object API to libnftables Alvaro Neira
  2013-09-25 20:11 ` [libnftables PATCH v2 1/2] rule: json: Fixed wrong offset return Pablo Neira Ayuso
  0 siblings, 2 replies; 5+ messages in thread
From: Alvaro Neira @ 2013-09-24 12:54 UTC (permalink / raw)
  To: netfilter-devel; +Cc: eric

From: Álvaro Neira Ayuso <alvaroneay@gmail.com>

I have fixed the offset because when i try to print more of one rule,
the json output support only print one rule because this function return
a wrong offset value

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
---
 src/rule.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rule.c b/src/rule.c
index e744cf8..e593109 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -748,7 +748,7 @@ static int nft_rule_snprintf_json(char *buf, size_t size, struct nft_rule *r,
 	ret = snprintf(buf+offset-1, len, "]}}");
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
-	return offset;
+	return offset-1;
 }
 
 static int nft_rule_snprintf_xml(char *buf, size_t size, struct nft_rule *r,

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-09-25 21:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-24 12:54 [libnftables PATCH v2 1/2] rule: json: Fixed wrong offset return Alvaro Neira
2013-09-24 12:54 ` [libnftables PATCH v2 2/2] This patch adds a ruleset object API to libnftables Alvaro Neira
2013-09-25 20:38   ` Pablo Neira Ayuso
2013-09-25 21:11     ` Arturo Borrero Gonzalez
2013-09-25 20:11 ` [libnftables PATCH v2 1/2] rule: json: Fixed wrong offset return Pablo Neira Ayuso

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).