Re: [iproute PATCH 50/51] Check user supplied interface name lengths

2017-09-01 Thread Phil Sutter
Hi Stephen, On Tue, Aug 15, 2017 at 06:51:32PM +0200, Phil Sutter wrote: > On Tue, Aug 15, 2017 at 09:09:45AM -0700, Stephen Hemminger wrote: > > On Sat, 12 Aug 2017 14:05:09 +0200 > > Phil Sutter wrote: > > > > > +void assert_valid_dev_name(const char *, const char *); > > > > Not a fan of lon

Re: [iproute PATCH 50/51] Check user supplied interface name lengths

2017-08-15 Thread Phil Sutter
On Tue, Aug 15, 2017 at 09:09:45AM -0700, Stephen Hemminger wrote: > On Sat, 12 Aug 2017 14:05:09 +0200 > Phil Sutter 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

Re: [iproute PATCH 50/51] Check user supplied interface name lengths

2017-08-15 Thread Stephen Hemminger
On Sat, 12 Aug 2017 14:05:09 +0200 Phil Sutter 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 th

[iproute PATCH 50/51] Check user supplied interface name lengths

2017-08-12 Thread Phil Sutter
The original problem was that something like: | strncpy(ifr.ifr_name, *argv, IFNAMSIZ); might leave ifr.ifr_name unterminated if length of *argv exceeds IFNAMSIZ. In order to fix this, I thought about replacing all those cases with (equivalent) calls to snprintf() or even introducing strlcpy(). B