[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170815165132.GI16375@orbyte.nwl.cc>
Date: Tue, 15 Aug 2017 18:51:32 +0200
From: Phil Sutter <phil@....cc>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [iproute PATCH 50/51] Check user supplied interface name lengths
On Tue, Aug 15, 2017 at 09:09:45AM -0700, Stephen Hemminger wrote:
> On Sat, 12 Aug 2017 14:05:09 +0200
> Phil Sutter <phil@....cc> wrote:
>
> > +void assert_valid_dev_name(const char *, const char *);
>
> Not a fan of long function names.
> “I have only made this letter longer because I have not had the time to make it shorter."
:)
> Maybe just add a new function addattr_ifname() and add the checking there?
It is not only about netlink attributes - these are in fact
unproblematic, since they allow for interface names longer than
IFNAMSIZ-1 and the kernel will then reject. The length check has to
happen before copying into any IFNAMSIZ-sized buffer takes place (e.g.
ifr_name of struct ifreq). Logically I would prefer to perform the
checks right at the point user input parsing takes place since it
belongs there.
I could rename the function to 'ifname_valid' instead? I liked having
'assert' in the name though, since the function calls exit() on error.
Thanks, Phil
Powered by blists - more mailing lists