[PATCH] fix off-by-one in rtnl_act_parse()

Thomas Haller thaller at redhat.com
Mon Mar 31 03:47:22 EDT 2014


On Fri, 2014-03-28 at 17:28 -0700, Cong Wang wrote:
> On Fri, Mar 28, 2014 at 6:17 AM, Thomas Haller <thaller at redhat.com> wrote:
> > Hi,
> >
> > Cong, why do you think that libnl should shift the index "i" by one?
> > Sorry, I just don't see it :)
> >
> >
> > kernel also uses similar loops:
> >
> > $ git grep -n for.*TCA_ACT_MAX_PRIO
> > net/sched/act_api.c:593: for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
> > net/sched/act_api.c:871: for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
> 
> I had the same conclusion until I saw a crash. ;)
> 
> For some reason I don't know,  the message dumped by kernel uses 0..MAX-1,
> while the message to create new action uses 1..MAX. It is indeed weird for me
> too.

Ok then :)

Pushed to master as:
https://github.com/thom311/libnl/commit/baa2cadd02086a053eb140c91d7f0681112ac370


Thank you,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20140331/f51d3ef8/attachment.sig>


More information about the libnl mailing list