summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-12-14 20:40:24 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-12-15 16:23:00 +0100
commit8bcf10b504c692deb3c98d395f42d34141f21e59 (patch)
treecd2b6c6dbd696ecb88805572e33f001d00d57000
parentdbaf6ea8f6a1a1e7f1d5abc2e4e2fef891c471b7 (diff)
set_elem: Don't return garbage in nftnl_set_elems_parse()
This might happen if netlink message is malformed (no nested attributes are present), so treat this as an error and return -1 instead of garbage to caller. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/set_elem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/set_elem.c b/src/set_elem.c
index e45dbc6..71c279a 100644
--- a/src/set_elem.c
+++ b/src/set_elem.c
@@ -490,7 +490,7 @@ nftnl_set_elem_list_parse_attr_cb(const struct nlattr *attr, void *data)
static int nftnl_set_elems_parse(struct nftnl_set *s, const struct nlattr *nest)
{
struct nlattr *attr;
- int ret;
+ int ret = -1;
mnl_attr_for_each_nested(attr, nest) {
if (mnl_attr_get_type(attr) != NFTA_LIST_ELEM)