summaryrefslogtreecommitdiffstats
path: root/examples/nft-compat-get.c
diff options
context:
space:
mode:
authorArturo Borrero <arturo.borrero.glez@gmail.com>2014-02-26 19:13:26 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2014-02-27 10:35:08 +0100
commitcfe671fa741c9669cadc5dfbf9ae63eb440601cf (patch)
treeeadb2e1a0242a4a49808327efa1e05bc19f8726f /examples/nft-compat-get.c
parent313c702ad8700ee5a959d81fd5b2da38e161c278 (diff)
src: check if netlink parsing fails
We have to check if mnl_attr_parse() returns an error, which means that it failed to validate and retrieve the attributes. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'examples/nft-compat-get.c')
-rw-r--r--examples/nft-compat-get.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/nft-compat-get.c b/examples/nft-compat-get.c
index 3294028..8f00cbf 100644
--- a/examples/nft-compat-get.c
+++ b/examples/nft-compat-get.c
@@ -51,7 +51,8 @@ static int cb(const struct nlmsghdr *nlh, void *data)
struct nlattr *tb[NFTA_COMPAT_MAX+1] = {};
struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh);
- mnl_attr_parse(nlh, sizeof(*nfg), data_attr_cb, tb);
+ if (mnl_attr_parse(nlh, sizeof(*nfg), data_attr_cb, tb) < 0)
+ return MNL_CB_ERROR;
if (tb[NFTA_COMPAT_NAME])
printf("name=%s ", mnl_attr_get_str(tb[NFTA_COMPAT_NAME]));