iproute2/lib
Phil Sutter 7c87c7fed1 lib/bpf: Fix bytecode-file parsing
The signedness of char type is implementation dependent, and there are
architectures on which it is unsigned by default. In that case, the
check whether fgetc() returned EOF failed because the return value was
assigned an (unsigned) char variable prior to comparison with EOF (which
is defined to -1). Fix this by using int as type for 'c' variable, which
also matches the declaration of fgetc().

While being at it, fix the parser logic to correctly handle multiple
empty lines and consecutive whitespace and tab characters to further
improve the parser's robustness. Note that this will still detect double
separator characters, so doesn't soften up the parser too much.

Fixes: 3da3ebfca8 ("bpf: Make bytecode-file reading a little more robust")
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
2017-09-04 12:06:50 -07:00
..
Makefile bpf: unbreak libelf linkage for bpf obj loader 2017-08-10 16:40:02 -07:00
bpf.c lib/bpf: Fix bytecode-file parsing 2017-09-04 12:06:50 -07:00
color.c color: use "light" colors for dark background 2017-03-03 09:58:05 -08: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_writer.c json_writer: Removed automatic json-object type from the constructor 2016-07-20 12:02:02 -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
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 utils: Implement strlcpy() and strlcat() 2017-09-01 12:10:54 -07:00