diff options
author | Paul Stewart <pstew@google.com> | 2016-11-09 18:09:07 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-11-09 18:09:07 +0000 |
commit | 1f4863065467cf6b61aeb9cf4b3c01f219dc3471 (patch) | |
tree | 04fa4ac4fae8a79fa7d78ea929090a6f2a726192 | |
parent | 74c5971cb326393625422ddf3be99e8a50e18fc2 (diff) | |
parent | c9e7458d7658809551e93c01f9374046d5e51a31 (diff) | |
download | libnl-1f4863065467cf6b61aeb9cf4b3c01f219dc3471.tar.gz |
libnl: Check data length in nla_reserve / nla_put am: f01b03b81a am: c198930bbb am: 2df2c5fa22 am: 65f43269a0 am: c7d03e591b am: 1ecc7536e5 am: 5399bd1024 am: df24328b6e
am: c9e7458d76
Change-Id: I921da8af6f671b4ca31593c0e01b72a0e61655a9
-rw-r--r-- | lib/attr.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -800,6 +800,9 @@ struct nlattr *nla_reserve(struct nl_msg *msg, int attrtype, int attrlen) struct nlattr *nla; int tlen; + if (attrlen < 0) + return NULL; + tlen = NLMSG_ALIGN(msg->nm_nlh->nlmsg_len) + nla_total_size(attrlen); if ((tlen + msg->nm_nlh->nlmsg_len) > msg->nm_size) @@ -838,6 +841,9 @@ int nla_put(struct nl_msg *msg, int attrtype, int datalen, const void *data) { struct nlattr *nla; + if (datalen < 0) + return -NLE_RANGE; + nla = nla_reserve(msg, attrtype, datalen); if (!nla) return -NLE_NOMEM; |