Skip to content

Commit 35533dc

Browse files
anakryikoKernel Patches Daemon
authored andcommitted
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>
1 parent c4165d5 commit 35533dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/usdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ static int parse_lib_segs(int pid, const char *lib_path, struct elf_seg **segs,
456456
if (!realpath(lib_path, path)) {
457457
pr_warn("usdt: failed to get absolute path of '%s' (err %d), using path as is...\n",
458458
lib_path, -errno);
459-
strcpy(path, lib_path);
459+
libbpf_strlcpy(path, lib_path, sizeof(path));
460460
}
461461

462462
proceed:

0 commit comments

Comments
 (0)