summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-04-22 16:12:27 (GMT)
committerThomas Haller <thaller@redhat.com>2022-04-22 16:12:27 (GMT)
commitf58a3c0608f744fbd539de1e2f8227fa41530e06 (patch)
treee46e3076b15d2f8714a038f1dcfd426eb5b83742
parent46506d3c1570f639726844fb689ab9b3d05b81e1 (diff)
downloadlibnl-f58a3c0608f744fbd539de1e2f8227fa41530e06.zip
libnl-f58a3c0608f744fbd539de1e2f8227fa41530e06.tar.gz
libnl-f58a3c0608f744fbd539de1e2f8227fa41530e06.tar.bz2
route/mdb: check parser error in mdb_msg_parser() for nested MDBA_MDB attribute
Coverity says: libnl-3.6.0/lib/route/mdb.c:198: check_return: Calling "nla_parse_nested" without checking return value (as is done elsewhere 43 out of 44 times).
-rw-r--r--lib/route/mdb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/route/mdb.c b/lib/route/mdb.c
index 4779ca3..459959e 100644
--- a/lib/route/mdb.c
+++ b/lib/route/mdb.c
@@ -194,8 +194,10 @@ static int mdb_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
if (tb[MDBA_MDB]) {
struct nlattr *db_attr[MDBA_MDB_MAX+1];
- nla_parse_nested(db_attr, MDBA_MDB_MAX, tb[MDBA_MDB],
- mdb_db_policy);
+ err = nla_parse_nested(db_attr, MDBA_MDB_MAX, tb[MDBA_MDB],
+ mdb_db_policy);
+ if (err < 0)
+ return err;
rem = nla_len(tb[MDBA_MDB]);
for (nla = nla_data(tb[MDBA_MDB]); nla_ok(nla, rem);