All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arturo Borrero <arturo.borrero.glez@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org
Subject: [libnftables PATCH 2/5] rule: fix snprintf return value
Date: Mon, 03 Jun 2013 22:44:52 +0200	[thread overview]
Message-ID: <20130603204452.27713.79515.stgit@nfdev.cica.es> (raw)
In-Reply-To: <20130603204451.27713.51887.stgit@nfdev.cica.es>

This cause some chained snprintf to fail.

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 src/rule.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rule.c b/src/rule.c
index f0208d9..a91d21d 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -676,7 +676,7 @@ static int nft_rule_snprintf_xml(char *buf, size_t size, struct nft_rule *r,
 	ret = snprintf(buf+offset, len, "</rule>");
 	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
-	return ret;
+	return offset;
 }
 
 static int nft_rule_snprintf_default(char *buf, size_t size, struct nft_rule *r, 
@@ -699,7 +699,7 @@ static int nft_rule_snprintf_default(char *buf, size_t size, struct nft_rule *r,
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 	}
 
-	return ret;
+	return offset;
 }
 
 int nft_rule_snprintf(char *buf, size_t size, struct nft_rule *r,


  reply	other threads:[~2013-06-03 20:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 20:44 [libnftables PATCH 1/5] data_reg: xml: fix bytes movements Arturo Borrero
2013-06-03 20:44 ` Arturo Borrero [this message]
2013-06-05  3:09   ` [libnftables PATCH 2/5] rule: fix snprintf return value Pablo Neira Ayuso
2013-06-03 20:44 ` [libnftables PATCH 3/5] src: xml: set errno to EINVAL when invalid parsing Arturo Borrero
2013-06-05  3:38   ` Pablo Neira Ayuso
2013-06-03 20:44 ` [libnftables PATCH 4/5] expr: xml: don't print target&match info Arturo Borrero
2013-06-03 20:44 ` [libnftables PATCH 5/5] examples: get XML ruleset Arturo Borrero

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=20130603204452.27713.79515.stgit@nfdev.cica.es \
    --to=arturo.borrero.glez@gmail.com \
    --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.