Re: [PATCH] netlink: fix overrun in attribute iteration

From: Thomas Graf
Date: Thu Sep 11 2008 - 20:35:27 EST


* David Miller <davem@xxxxxxxxxxxxx> 2008-09-11 15:04
> From: Vegard Nossum <vegard.nossum@xxxxxxxxx>
> Thomas, please review.
>
> > diff --git a/include/net/netlink.h b/include/net/netlink.h
> > index 18024b8..208fe5a 100644
> > --- a/include/net/netlink.h
> > +++ b/include/net/netlink.h
> > @@ -702,7 +702,7 @@ static inline int nla_len(const struct nlattr *nla)
> > */
> > static inline int nla_ok(const struct nlattr *nla, int remaining)
> > {
> > - return remaining >= sizeof(*nla) &&
> > + return remaining >= (int) sizeof(*nla) &&
> > nla->nla_len >= sizeof(*nla) &&
> > nla->nla_len <= remaining;
> > }

Very nice catch, would never have thought of that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/