projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
700a6ef
)
libbpf: Use strlcpy() in path resolution fallback logic
author
Andrii Nakryiko
<andrii@kernel.org>
Thu, 7 Apr 2022 23:04:45 +0000
(16:04 -0700)
committer
Alexei Starovoitov
<ast@kernel.org>
Fri, 8 Apr 2022 16:16:09 +0000
(09:16 -0700)
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
tools/lib/bpf/usdt.c
patch
|
blob
|
history
diff --git
a/tools/lib/bpf/usdt.c
b/tools/lib/bpf/usdt.c
index 30c495a6554c991f69654cef19e06a7ad34e0c62..acf2d99a9e7727284a0593a7b610593afe3b4c5c 100644
(file)
--- 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: