From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH libnftnl] src: don't set data_len to zero when returning pointers
Date: Mon, 1 Aug 2016 14:02:08 +0200 [thread overview]
Message-ID: <1470052928-13111-1-git-send-email-pablo@netfilter.org> (raw)
nft already assumes that passing NULL as data_len is valid, otherwise
it crashes. Fix this by leave data_len unset in this specific case.
Fixes: bda7102 ("src: Fix nftnl_*_get_data() to return the real attribute length")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/expr/dynset.c | 1 -
src/set_elem.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/src/expr/dynset.c b/src/expr/dynset.c
index 111bf8c..0eaa409 100644
--- a/src/expr/dynset.c
+++ b/src/expr/dynset.c
@@ -94,7 +94,6 @@ nftnl_expr_dynset_get(const struct nftnl_expr *e, uint16_t type,
*data_len = sizeof(dynset->set_id);
return &dynset->set_id;
case NFTNL_EXPR_DYNSET_EXPR:
- *data_len = 0;
return dynset->expr;
}
return NULL;
diff --git a/src/set_elem.c b/src/set_elem.c
index 4e89210..7908661 100644
--- a/src/set_elem.c
+++ b/src/set_elem.c
@@ -184,7 +184,6 @@ const void *nftnl_set_elem_get(struct nftnl_set_elem *s, uint16_t attr, uint32_t
*data_len = s->user.len;
return s->user.data;
case NFTNL_SET_ELEM_EXPR:
- *data_len = 0;
return s->expr;
}
return NULL;
--
2.1.4
reply other threads:[~2016-08-01 12:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1470052928-13111-1-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--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).