[libnftnl PATCH 6/7] Avoid returning uninitialized data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 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

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



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux