summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/usdt.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-04-08 02:04:45 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-04-08 19:16:09 +0300
commit3c0dfe6e4c43ea0cf252ff4cb7a332423866d488 (patch)
tree2fbe8d301b1b00aae314aa2fa51acdd02ffb100d /tools/lib/bpf/usdt.c
parent700a6ef1fa6096b2782c03a6be41af0f88afad1d (diff)
downloadlinux-3c0dfe6e4c43ea0cf252ff4cb7a332423866d488.tar.xz
libbpf: Use strlcpy() in path resolution fallback logic
Coverity static analyzer complains that strcpy() can cause buffer overflow. Use libbpf_strlcpy() instead to be 100% sure this doesn't happen. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220407230446.3980075-1-andrii@kernel.org
Diffstat (limited to 'tools/lib/bpf/usdt.c')
-rw-r--r--tools/lib/bpf/usdt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
index 30c495a6554c..acf2d99a9e77 100644
--- a/tools/lib/bpf/usdt.c
+++ b/tools/lib/bpf/usdt.c
@@ -456,7 +456,7 @@ static int parse_lib_segs(int pid, const char *lib_path, struct elf_seg **segs,
if (!realpath(lib_path, path)) {
pr_warn("usdt: failed to get absolute path of '%s' (err %d), using path as is...\n",
lib_path, -errno);
- strcpy(path, lib_path);
+ libbpf_strlcpy(path, lib_path, sizeof(path));
}
proceed: