From 260a92afe65b78cb775b36ca8fc15b03239d8b76 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 20 Apr 2018 10:38:00 -0700 Subject: [PATCH] bpf: fix warnings on gcc-8 about string truncation In theory, the path for BPF could exceed the 4K PATH_MAX. In practice, not really possible. But shut up gcc. Signed-off-by: Stephen Hemminger --- lib/bpf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bpf.c b/lib/bpf.c index 04bc5a56..d9a406bf 100644 --- a/lib/bpf.c +++ b/lib/bpf.c @@ -634,7 +634,7 @@ static int bpf_gen_global(const char *bpf_sub_dir) static int bpf_gen_master(const char *base, const char *name) { - char bpf_sub_dir[PATH_MAX]; + char bpf_sub_dir[PATH_MAX + NAME_MAX + 1]; int ret; snprintf(bpf_sub_dir, sizeof(bpf_sub_dir), "%s%s/", base, name); @@ -675,8 +675,8 @@ static int bpf_slave_via_bind_mnt(const char *full_name, static int bpf_gen_slave(const char *base, const char *name, const char *link) { - char bpf_lnk_dir[PATH_MAX]; - char bpf_sub_dir[PATH_MAX]; + char bpf_lnk_dir[PATH_MAX + NAME_MAX + 1]; + char bpf_sub_dir[PATH_MAX + NAME_MAX]; struct stat sb = {}; int ret;