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 <stephen@networkplumber.org>
This commit is contained in:
parent
0aaf62fcb6
commit
260a92afe6
|
|
@ -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)
|
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;
|
int ret;
|
||||||
|
|
||||||
snprintf(bpf_sub_dir, sizeof(bpf_sub_dir), "%s%s/", base, name);
|
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,
|
static int bpf_gen_slave(const char *base, const char *name,
|
||||||
const char *link)
|
const char *link)
|
||||||
{
|
{
|
||||||
char bpf_lnk_dir[PATH_MAX];
|
char bpf_lnk_dir[PATH_MAX + NAME_MAX + 1];
|
||||||
char bpf_sub_dir[PATH_MAX];
|
char bpf_sub_dir[PATH_MAX + NAME_MAX];
|
||||||
struct stat sb = {};
|
struct stat sb = {};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue