X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=net%2Fnetlink%2Fattr.c;h=56c3ce7fe29af8b2bf47dd8bdc41edb93576c70a;hb=4c44323db15f26f4c744f06179daa43711cdb708;hp=2d106cfe1d276bf5e234195753eb091cba7b7f1e;hpb=7dc9719682ce8c46215bc9a1bdc7ee0c38ada94b;p=linux-2.6-omap-h63xx.git diff --git a/net/netlink/attr.c b/net/netlink/attr.c index 2d106cfe1d2..56c3ce7fe29 100644 --- a/net/netlink/attr.c +++ b/net/netlink/attr.c @@ -83,6 +83,12 @@ static int validate_nla(struct nlattr *nla, int maxtype, if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN + nla_len(nla)) return -ERANGE; break; + case NLA_NESTED: + /* a nested attributes is allowed to be empty; if its not, + * it must have a size of at least NLA_HDRLEN. + */ + if (attrlen == 0) + break; default: if (pt->len) minlen = pt->len; @@ -233,7 +239,7 @@ size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) * * Returns the number of bytes copied. */ -int nla_memcpy(void *dest, struct nlattr *src, int count) +int nla_memcpy(void *dest, const struct nlattr *src, int count) { int minlen = min_t(int, count, nla_len(src));