From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [libnftnl PATCH 6/7] Avoid returning uninitialized data
Date: Fri, 12 Aug 2016 01:33:38 +0200 [thread overview]
Message-ID: <1470958419-32602-7-git-send-email-phil@nwl.cc> (raw)
In-Reply-To: <1470958419-32602-1-git-send-email-phil@nwl.cc>
Although the 'err' pointer should be interesting for users only if the
parser returned non-zero, having it point to uninitialized data is
generally a bad thing.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
src/chain.c | 2 +-
src/rule.c | 2 +-
src/set.c | 2 +-
src/table.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/chain.c b/src/chain.c
index ff59f7f705783..dfe0cf23b0f51 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -816,7 +816,7 @@ static int nftnl_chain_do_parse(struct nftnl_chain *c, enum nftnl_parse_type typ
enum nftnl_parse_input input)
{
int ret;
- struct nftnl_parse_err perr;
+ struct nftnl_parse_err perr = {};
switch (type) {
case NFTNL_PARSE_XML:
diff --git a/src/rule.c b/src/rule.c
index dada00e1cc99f..8aeefbe19a9ed 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -700,7 +700,7 @@ static int nftnl_rule_do_parse(struct nftnl_rule *r, enum nftnl_parse_type type,
enum nftnl_parse_input input)
{
int ret;
- struct nftnl_parse_err perr;
+ struct nftnl_parse_err perr = {};
switch (type) {
case NFTNL_PARSE_XML:
diff --git a/src/set.c b/src/set.c
index 7a41e8caeb3c0..47b6ef46a9c34 100644
--- a/src/set.c
+++ b/src/set.c
@@ -781,7 +781,7 @@ static int nftnl_set_do_parse(struct nftnl_set *s, enum nftnl_parse_type type,
enum nftnl_parse_input input)
{
int ret;
- struct nftnl_parse_err perr;
+ struct nftnl_parse_err perr = {};
switch (type) {
case NFTNL_PARSE_XML:
diff --git a/src/table.c b/src/table.c
index bb46716950b98..845fd68168797 100644
--- a/src/table.c
+++ b/src/table.c
@@ -360,7 +360,7 @@ static int nftnl_table_do_parse(struct nftnl_table *t, enum nftnl_parse_type typ
enum nftnl_parse_input input)
{
int ret;
- struct nftnl_parse_err perr;
+ struct nftnl_parse_err perr = {};
switch (type) {
case NFTNL_PARSE_XML:
--
2.8.2
next prev parent reply other threads:[~2016-08-11 23:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 23:33 [libnftnl PATCH 0/7] A bunch of covscan detected fixes Phil Sutter
2016-08-11 23:33 ` [libnftnl PATCH 1/7] set: prevent memleak in nftnl_jansson_parse_set_info() Phil Sutter
2016-08-11 23:33 ` [libnftnl PATCH 2/7] ruleset: Prevent memleak in nftnl_ruleset_snprintf_*() functions Phil Sutter
2016-08-11 23:42 ` Pablo Neira Ayuso
2016-08-12 0:44 ` Phil Sutter
2016-08-12 8:38 ` Pablo Neira Ayuso
2016-08-11 23:33 ` [libnftnl PATCH 3/7] expr/ct: prevent array index overrun in ctkey2str() Phil Sutter
2016-08-11 23:33 ` [libnftnl PATCH 4/7] expr/limit: Drop unreachable code in limit_to_type() Phil Sutter
2016-08-11 23:33 ` [libnftnl PATCH 5/7] common: Avoid integer overflow in nftnl_batch_is_supported() Phil Sutter
2016-08-11 23:48 ` Pablo Neira Ayuso
2016-08-11 23:33 ` Phil Sutter [this message]
2016-08-11 23:33 ` [libnftnl PATCH 7/7] ruleset: Initialize ctx.flags before calling nftnl_ruleset_ctx_set() Phil Sutter
2016-08-11 23:58 ` [libnftnl PATCH 0/7] A bunch of covscan detected fixes Pablo Neira Ayuso
2016-08-12 0:05 ` Pablo Neira Ayuso
2016-08-12 0:47 ` Phil Sutter
2016-08-12 8:40 ` Pablo Neira Ayuso
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=1470958419-32602-7-git-send-email-phil@nwl.cc \
--to=phil@nwl.cc \
--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 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).