lxc_user_nic: remove stack allocations

parent 861cb8c2
...@@ -368,9 +368,11 @@ lxc_monitord_SOURCES = cmd/lxc_monitord.c \ ...@@ -368,9 +368,11 @@ lxc_monitord_SOURCES = cmd/lxc_monitord.c \
lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
../include/netns_ifaddrs.c ../include/netns_ifaddrs.h \ ../include/netns_ifaddrs.c ../include/netns_ifaddrs.h \
log.c log.h \ log.c log.h \
memory_utils.h \
network.c network.h \ network.c network.h \
parse.c parse.h \ parse.c parse.h \
raw_syscalls.c raw_syscalls.h \ raw_syscalls.c raw_syscalls.h \
string_utils.c string_utils.h \
syscall_wrappers.h syscall_wrappers.h
lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \ lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
conf.c conf.h \ conf.c conf.h \
......
...@@ -49,9 +49,11 @@ ...@@ -49,9 +49,11 @@
#include "config.h" #include "config.h"
#include "log.h" #include "log.h"
#include "memory_utils.h"
#include "network.h" #include "network.h"
#include "parse.h" #include "parse.h"
#include "raw_syscalls.h" #include "raw_syscalls.h"
#include "string_utils.h"
#include "syscall_wrappers.h" #include "syscall_wrappers.h"
#include "utils.h" #include "utils.h"
...@@ -838,13 +840,12 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid, ...@@ -838,13 +840,12 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
static bool create_db_dir(char *fnam) static bool create_db_dir(char *fnam)
{ {
int ret; __do_free char *copy;
char *p; char *p;
size_t len; int ret;
len = strlen(fnam); copy = must_copy_string(fnam);
p = alloca(len + 1); p = copy;
(void)strlcpy(p, fnam, len + 1);
fnam = p; fnam = p;
p = p + 1; p = p + 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment