]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
src: Avoid returning uninitialized data
authorPhil Sutter <phil@nwl.cc>
Thu, 11 Aug 2016 23:33:38 +0000 (01:33 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 11 Aug 2016 23:56:50 +0000 (01:56 +0200)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/chain.c
src/rule.c
src/set.c
src/table.c

index ff59f7f705783b333a9123b46368e49024a68e16..dfe0cf23b0f51d5efd9cfba804aca28cb68e93fe 100644 (file)
@@ -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:
index dada00e1cc99f0b26965fb87267f75acaaa72058..8aeefbe19a9eda1d9f41ea690f2ced1a22ca0fb6 100644 (file)
@@ -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:
index 7a41e8caeb3c0cc89b89fce86e388c04d29fde55..47b6ef46a9c34354d38146e461086ba41c9b9c1b 100644 (file)
--- 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:
index bb46716950b98fe846fbd320e14808a34647f7a1..845fd68168797e6d71c03cfe57fa145c9eaac486 100644 (file)
@@ -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: