From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Carlos Falgueras García" <carlosfg@riseup.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH libnftnl] Fix string length calculations
Date: Tue, 5 Jul 2016 14:31:25 +0200 [thread overview]
Message-ID: <20160705123125.GA27152@salvia> (raw)
In-Reply-To: <5778E53E.60607@riseup.net>
On Sun, Jul 03, 2016 at 12:13:18PM +0200, Carlos Falgueras García wrote:
> >>diff --git a/src/trace.c b/src/trace.c
> >>index d8f561d..1a50390 100644
> >>--- a/src/trace.c
> >>+++ b/src/trace.c
> >>@@ -165,13 +165,13 @@ const void *nftnl_trace_get_data(const struct nftnl_trace *trace,
> >> *data_len = sizeof(uint32_t);
> >> return &trace->type;
> >> case NFTNL_TRACE_CHAIN:
> >>- *data_len = strlen(trace->chain);
> >>+ *data_len = strlen(trace->chain) + 1;
> >> return trace->chain;
> >> case NFTNL_TRACE_TABLE:
> >>- *data_len = strlen(trace->table);
> >>+ *data_len = strlen(trace->table) + 1;
> >> return trace->table;
> >> case NFTNL_TRACE_JUMP_TARGET:
> >>- *data_len = strlen(trace->jump_target);
> >>+ *data_len = strlen(trace->jump_target) + 1;
> >> return trace->jump_target;
> >> case NFTNL_TRACE_TRANSPORT_HEADER:
> >> *data_len = trace->th.len;
> >Are you really sure we need this chunk too?
> Yes, I think the user would expect that 'data_len' means data length instead
> of data length minus one.
>
> When checking other getters I realized that in most cases we keep the
> parameter 'data_len' unset when the user ask for a string. Maybe we can fix
> these behavior, I think it make more sense if our getters always return the
> data length instead of keep an inconstant behavior.
_get() for strings functions should retain the strlen() semantics.
So I'd suggest you just fix the string setters.
--
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
next prev parent reply other threads:[~2016-07-05 12:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 16:24 [PATCH libnftnl] set: Fix nftnl_set_set_str Carlos Falgueras García
2016-06-27 16:29 ` Carlos Falgueras García
2016-07-01 14:22 ` Pablo Neira Ayuso
2016-07-01 16:07 ` [PATCH libnfntl v2] " Carlos Falgueras García
2016-07-01 16:11 ` [PATCH libnftnl] Fix string length calculations Carlos Falgueras García
2016-07-02 6:54 ` Pablo Neira Ayuso
2016-07-03 10:13 ` Carlos Falgueras García
2016-07-05 12:31 ` Pablo Neira Ayuso [this message]
2016-07-05 17:15 ` [PATCH 1/2 libnfntl] Fix nftnl_*_set_str Carlos Falgueras García
2016-07-05 17:15 ` [PATCH 2/2 libnfntl] Fix nftnl_*_get to set data_len Carlos Falgueras García
2016-07-06 15:21 ` Pablo Neira Ayuso
2016-07-11 11:41 ` [PATCH v2, libnftnl] " Carlos Falgueras García
2016-07-11 11:48 ` Pablo Neira Ayuso
2016-07-11 16:07 ` [PATCH v3, " Carlos Falgueras García
2016-07-11 17:18 ` Pablo Neira Ayuso
2016-07-11 10:24 ` [PATCH 2/2 libnfntl] " Pablo Neira Ayuso
2016-07-11 10:25 ` Pablo Neira Ayuso
2016-07-06 15:19 ` [PATCH 1/2 libnfntl] Fix nftnl_*_set_str Pablo Neira Ayuso
2016-07-01 16:13 ` [PATCH libnftnl] set: Fix nftnl_set_set_str Carlos Falgueras García
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=20160705123125.GA27152@salvia \
--to=pablo@netfilter.org \
--cc=carlosfg@riseup.net \
--cc=netfilter-devel@vger.kernel.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 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).