1
0
Fork 0
alistair23-linux/tools/lib
Andrey Zhizhikin e44b48f5bb tools lib api fs: Fix gcc9 stringop-truncation compilation error
[ Upstream commit 6794200fa3 ]

GCC9 introduced string hardening mechanisms, which exhibits the error
during fs api compilation:

error: '__builtin_strncpy' specified bound 4096 equals destination size
[-Werror=stringop-truncation]

This comes when the length of copy passed to strncpy is is equal to
destination size, which could potentially lead to buffer overflow.

There is a need to mitigate this potential issue by limiting the size of
destination by 1 and explicitly terminate the destination with NULL.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andriin@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org
Link: http://lore.kernel.org/lkml/20191211080109.18765-1-andrey.zhizhikin@leica-geosystems.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:43 +01:00
..
api tools lib api fs: Fix gcc9 stringop-truncation compilation error 2020-02-24 08:36:43 +01:00
bpf libbpf: Fix realloc usage in bpf_core_find_cands 2020-02-11 04:35:29 -08:00
lockdep lockdep/lib/tests: Test dynamic key registration 2019-02-28 07:55:48 +01:00
subcmd libsubcmd: Use -O0 with DEBUG=1 2019-12-31 16:44:56 +01:00
symbol tools perf: Move from sane_ctype.h obtained from git to the Linux's original 2019-06-25 21:02:47 -03:00
traceevent tools lib traceevent: Fix memory leakage in filter_event 2020-02-05 21:22:43 +00:00
argv_split.c tools lib: Move argv_{split,free} from tools/perf/util/ 2019-07-01 22:50:40 -03:00
bitmap.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 230 2019-06-19 17:09:06 +02:00
ctype.c tools perf: Move from sane_ctype.h obtained from git to the Linux's original 2019-06-25 21:02:47 -03:00
find_bit.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hweight.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rbtree.c rbtree: avoid generating code twice for the cached versions (tools copy) 2019-09-25 17:51:39 -07:00
str_error_r.c objtool, perf: Fix GCC 8 -Wrestrict error 2018-03-19 13:51:54 -03:00
string.c tools lib: Fix builds when glibc contains strlcpy() 2020-02-05 21:22:40 +00:00
vsprintf.c perf script: Pad DSO name for --call-trace 2019-05-28 18:37:44 -03:00
zalloc.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00