mirror_iproute2/lib
Phil Sutter 625df645b7 Check user supplied interface name lengths
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(). But as Ulrich Drepper correctly pointed out when rejecting
the latter from being added to glibc, truncating a string without
notifying the user is not to be considered good practice. So let's
excercise what he suggested and reject empty, overlong or otherwise
invalid interface names right from the start - this way calls to
strncpy() like shown above become safe and the user has a chance to
reconsider what he was trying to do.

Note that this doesn't add calls to check_ifname() to all places where
user supplied interface name is parsed. In many cases, the interface
must exist already and is therefore looked up using ll_name_to_index(),
so if_nametoindex() will perform the necessary checks already.

Signed-off-by: Phil Sutter <phil@nwl.cc>
2017-10-02 08:01:21 -07:00
..
bpf.c bpf: properly output json for xdp 2017-09-22 10:07:15 -07:00
color.c color: add new COLOR_NONE and disable_color function 2017-08-17 18:02:40 -07:00
coverity_model.c scrub out whitespace issues 2016-03-27 10:50:14 -07:00
dnet_ntop.c scrub out whitespace issues 2016-03-27 10:50:14 -07:00
dnet_pton.c dnet: fix strict aliasing warnings 2010-07-23 12:30:48 -07:00
exec.c move cmd_exec to lib utils 2016-12-13 10:20:16 -08:00
fs.c Convert the obvious cases to strlcpy() 2017-09-01 12:10:54 -07:00
inet_proto.c Convert the obvious cases to strlcpy() 2017-09-01 12:10:54 -07:00
ipx_ntop.c scrub out whitespace issues 2016-03-27 10:50:14 -07:00
ipx_pton.c utils: provide get_hex to read a hex digit from a char 2016-06-08 09:30:41 -07:00
json_print.c lib: json_print: rework 'new_json_obj' drop FILE* argument 2017-09-29 10:10:47 -07:00
json_writer.c json_writer: add new json handlers (null, float with format, lluint, hu) 2017-08-17 18:02:40 -07:00
libgenl.c libgenl: introduce genl_init_handle 2016-08-17 13:59:21 -07:00
libnetlink.c lib/libnetlink: Don't pass NULL parameter to memcpy() 2017-08-24 15:22:10 -07:00
ll_addr.c remove duplicated #include's 2017-07-18 17:17:15 -07:00
ll_map.c lib/ll_map: Choose size of new cache items at run-time 2017-08-24 14:53:14 -07:00
ll_proto.c remove duplicated #include's 2017-07-18 17:17:15 -07:00
ll_types.c remove duplicated #include's 2017-07-18 17:17:15 -07:00
Makefile json: move json printer to common library 2017-09-22 10:06:43 -07:00
mpls_ntop.c ip: mpls: fix printing of mpls labels 2017-05-11 11:08:02 -07:00
mpls_pton.c ip: add support for more MPLS labels 2017-05-22 11:03:02 -07:00
names.c Replace malloc && memset by calloc 2016-07-20 12:05:24 -07:00
namespace.c lib/namespace: fix fd leakage in non-error case 2015-08-19 16:32:56 -07:00
rt_names.c lib/rt_names: Drop dead code in rtnl_rttable_n2a() 2017-08-21 17:12:21 -07:00
utils.c Check user supplied interface name lengths 2017-10-02 08:01:21 -07:00