namespace: limit the length of namespace name to avoid snprintf overflow
This fixes problem reported by gcc-8 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
08a93b32f5
commit
89e3c36b06
|
|
@ -17,12 +17,15 @@
|
|||
|
||||
static void bind_etc(const char *name)
|
||||
{
|
||||
char etc_netns_path[PATH_MAX];
|
||||
char etc_netns_path[sizeof(NETNS_ETC_DIR) + NAME_MAX];
|
||||
char netns_name[PATH_MAX];
|
||||
char etc_name[PATH_MAX];
|
||||
struct dirent *entry;
|
||||
DIR *dir;
|
||||
|
||||
if (strlen(name) >= NAME_MAX)
|
||||
return;
|
||||
|
||||
snprintf(etc_netns_path, sizeof(etc_netns_path), "%s/%s", NETNS_ETC_DIR, name);
|
||||
dir = opendir(etc_netns_path);
|
||||
if (!dir)
|
||||
|
|
|
|||
Loading…
Reference in New Issue