[quagga-dev 3081] Re: bugs related to length of interface names

Andrew J. Schorr aschorr at telemetry-investments.com
Sat Apr 2 02:58:12 BST 2005

On Fri, Apr 01, 2005 at 11:34:55PM +0100, Paul Jakma wrote:
> > But in any case, the 
> >safer call would look like this:
> >
> >  ifp = if_get_by_name_len(lifreq->lifr_name,
> >			    strnlen(lifreq->lifr_name,
> >				    sizeof(lifreq->lifr_name)));
> >
> >Then we would be 100% safe.  Certainly the existing code which 
> >assumes that lifreq->lifr_name has a maximum length of 
> >INTERFACE_NAMSIZ bytes does not appear to be correct...
> Yep, you're right.

OK, good, moving forward, I have a couple of questions:

1. I'm adding strnlen to lib/str.c, and a configure check to configure.ac.
And I'm declaring it in lib/str.h.  But I wonder why "str.h" is not included
by zebra.h?  Since zebra.h includes string.h and stdio.h, it seems to
me that it should just go ahead and also include lib/str.h to pick up
any functions that may be missing on this platform.  What do you think?
At the moment, "str.h" is included in a few files on an ad hoc basis,
but that doesn't seem to make sense to me...

2. Regarding the new function names: is the decision to use an _len
suffix?  As in if_lookup_by_name_len and if_get_by_name_len?  Or is
there some shorter name that would be reasonable?


More information about the Quagga-dev mailing list