idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
35,700
static void free_subsystems(void) { int i; for (i = 0; i < nr_subsystems; i++) free(subsystems[i]); free(subsystems); subsystems = NULL; nr_subsystems = 0; }
null
0
static void free_subsystems(void) { int i; for (i = 0; i < nr_subsystems; i++) free(subsystems[i]); free(subsystems); subsystems = NULL; nr_subsystems = 0; }
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,701
static bool in_subsystem_list(const char *c) { int i; for (i = 0; i < nr_subsystems; i++) { if (strcmp(c, subsystems[i]) == 0) return true; } return false; }
null
0
static bool in_subsystem_list(const char *c) { int i; for (i = 0; i < nr_subsystems; i++) { if (strcmp(c, subsystems[i]) == 0) return true; } return false; }
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,702
static bool lxc_cgmanager_chmod(const char *controller, const char *cgroup_path, const char *file, int mode) { if (cgmanager_chmod_sync(NULL, cgroup_manager, controller, cgroup_path, file, mode) != 0) { NihError *nerr; nerr = nih_error_get(); ERROR("call to cgmanager_chmod_sync failed: %s", nerr->message); ...
null
0
static bool lxc_cgmanager_chmod(const char *controller, const char *cgroup_path, const char *file, int mode) { if (cgmanager_chmod_sync(NULL, cgroup_manager, controller, cgroup_path, file, mode) != 0) { NihError *nerr; nerr = nih_error_get(); ERROR("call to cgmanager_chmod_sync failed: %s", nerr->message); ...
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,703
static bool lxc_cgmanager_create(const char *controller, const char *cgroup_path, int32_t *existed) { bool ret = true; if ( cgmanager_create_sync(NULL, cgroup_manager, controller, cgroup_path, existed) != 0) { NihError *nerr; nerr = nih_error_get(); ERROR("call to cgmanager_create_sync failed: %s", n...
null
0
static bool lxc_cgmanager_create(const char *controller, const char *cgroup_path, int32_t *existed) { bool ret = true; if ( cgmanager_create_sync(NULL, cgroup_manager, controller, cgroup_path, existed) != 0) { NihError *nerr; nerr = nih_error_get(); ERROR("call to cgmanager_create_sync failed: %s", n...
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,704
static bool lxc_cgmanager_enter(pid_t pid, const char *controller, const char *cgroup_path, bool abs) { int ret; if (abs) ret = cgmanager_move_pid_abs_sync(NULL, cgroup_manager, controller, cgroup_path, pid); else ret = cgmanager_move_pid_sync(NULL, cgroup_manager, controller, cgroup_path, pid); if (re...
null
0
static bool lxc_cgmanager_enter(pid_t pid, const char *controller, const char *cgroup_path, bool abs) { int ret; if (abs) ret = cgmanager_move_pid_abs_sync(NULL, cgroup_manager, controller, cgroup_path, pid); else ret = cgmanager_move_pid_sync(NULL, cgroup_manager, controller, cgroup_path, pid); if (re...
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,705
static bool lxc_cgmanager_escape(void) { bool ret = true; pid_t me = getpid(); char **slist = subsystems; int i; if (cgm_all_controllers_same) slist = subsystems_inone; for (i = 0; slist[i]; i++) { if (cgmanager_move_pid_abs_sync(NULL, cgroup_manager, slist[i], "/", me) != 0) { NihError *nerr; ne...
null
0
static bool lxc_cgmanager_escape(void) { bool ret = true; pid_t me = getpid(); char **slist = subsystems; int i; if (cgm_all_controllers_same) slist = subsystems_inone; for (i = 0; slist[i]; i++) { if (cgmanager_move_pid_abs_sync(NULL, cgroup_manager, slist[i], "/", me) != 0) { NihError *nerr; ne...
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,706
static void process_lock_setup_atfork(void) { pthread_atfork(cgm_lock, cgm_unlock, cgm_unlock); }
null
0
static void process_lock_setup_atfork(void) { pthread_atfork(cgm_lock, cgm_unlock, cgm_unlock); }
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,707
static int send_creds(int sock, int rpid, int ruid, int rgid) { struct msghdr msg = { 0 }; struct iovec iov; struct cmsghdr *cmsg; struct ucred cred = { .pid = rpid, .uid = ruid, .gid = rgid, }; char cmsgbuf[CMSG_SPACE(sizeof(cred))]; char buf[1]; buf[0] = 'p'; msg.msg_control = cmsgbuf; msg.msg_contro...
null
0
static int send_creds(int sock, int rpid, int ruid, int rgid) { struct msghdr msg = { 0 }; struct iovec iov; struct cmsghdr *cmsg; struct ucred cred = { .pid = rpid, .uid = ruid, .gid = rgid, }; char cmsgbuf[CMSG_SPACE(sizeof(cred))]; char buf[1]; buf[0] = 'p'; msg.msg_control = cmsgbuf; msg.msg_contro...
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,708
static char *try_get_abs_cgroup(const char *name, const char *lxcpath, const char *controller) { char *cgroup = NULL; if (abs_cgroup_supported()) { /* get the container init pid and ask for its abs cgroup */ pid_t pid = lxc_cmd_get_init_pid(name, lxcpath); if (pid < 0) return NULL; if (cgmanager_get_pid...
null
0
static char *try_get_abs_cgroup(const char *name, const char *lxcpath, const char *controller) { char *cgroup = NULL; if (abs_cgroup_supported()) { /* get the container init pid and ask for its abs cgroup */ pid_t pid = lxc_cmd_get_init_pid(name, lxcpath); if (pid < 0) return NULL; if (cgmanager_get_pid...
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,709
static bool verify_and_prune(const char *cgroup_use) { const char *p; char *e; int i, j; for (p = cgroup_use; p && *p; p = e + 1) { e = strchr(p, ','); if (e) *e = '\0'; if (!in_subsystem_list(p)) { ERROR("Controller %s required by lxc.cgroup.use but not available\n", p); return false; } if (e...
null
0
static bool verify_and_prune(const char *cgroup_use) { const char *p; char *e; int i, j; for (p = cgroup_use; p && *p; p = e + 1) { e = strchr(p, ','); if (e) *e = '\0'; if (!in_subsystem_list(p)) { ERROR("Controller %s required by lxc.cgroup.use but not available\n", p); return false; } if (e...
@@ -1477,7 +1477,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname) } /* mount a tmpfs there so we can create subdirs */ - if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) { + if (safe_mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755", root)) { SYSERROR("Failed to mount...
CWE-59
null
null
35,710
static bool append_ptyname(char **pp, char *name) { char *p; if (!*pp) { *pp = malloc(strlen(name) + strlen("container_ttys=") + 1); if (!*pp) return false; sprintf(*pp, "container_ttys=%s", name); return true; } p = realloc(*pp, strlen(*pp) + strlen(name) + 2); if (!p) return false; *pp = p; strca...
null
0
static bool append_ptyname(char **pp, char *name) { char *p; if (!*pp) { *pp = malloc(strlen(name) + strlen("container_ttys=") + 1); if (!*pp) return false; sprintf(*pp, "container_ttys=%s", name); return true; } p = realloc(*pp, strlen(*pp) + strlen(name) + 2); if (!p) return false; *pp = p; strca...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,711
int chown_mapped_root(char *path, struct lxc_conf *conf) { uid_t rootuid; gid_t rootgid; pid_t pid; unsigned long val; char *chownpath = path; if (!get_mapped_rootid(conf, ID_TYPE_UID, &val)) { ERROR("No mapping for container root"); return -1; } rootuid = (uid_t) val; if (!get_mapped_rootid(conf, ID_TYPE...
null
0
int chown_mapped_root(char *path, struct lxc_conf *conf) { uid_t rootuid; gid_t rootgid; pid_t pid; unsigned long val; char *chownpath = path; if (!get_mapped_rootid(conf, ID_TYPE_UID, &val)) { ERROR("No mapping for container root"); return -1; } rootuid = (uid_t) val; if (!get_mapped_rootid(conf, ID_TYPE...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,712
static void cull_mntent_opt(struct mntent *mntent) { int i; char *p, *p2; char *list[] = {"create=dir", "create=file", "optional", NULL }; for (i=0; list[i]; i++) { if (!(p = strstr(mntent->mnt_opts, list[i]))) continue; p2 = strchr(p, ','); if (!p2) { /* no more mntopts, so just chop it here ...
null
0
static void cull_mntent_opt(struct mntent *mntent) { int i; char *p, *p2; char *list[] = {"create=dir", "create=file", "optional", NULL }; for (i=0; list[i]; i++) { if (!(p = strstr(mntent->mnt_opts, list[i]))) continue; p2 = strchr(p, ','); if (!p2) { /* no more mntopts, so just chop it here ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,713
int do_rootfs_setup(struct lxc_conf *conf, const char *name, const char *lxcpath) { if (conf->rootfs_setup) { /* * rootfs was set up in another namespace. bind-mount it * to give us a mount in our own ns so we can pivot_root to it */ const char *path = conf->rootfs.mount; if (mount(path, path, "rootfs"...
null
0
int do_rootfs_setup(struct lxc_conf *conf, const char *name, const char *lxcpath) { if (conf->rootfs_setup) { /* * rootfs was set up in another namespace. bind-mount it * to give us a mount in our own ns so we can pivot_root to it */ const char *path = conf->rootfs.mount; if (mount(path, path, "rootfs"...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,714
int find_unmapped_nsuid(struct lxc_conf *conf, enum idtype idtype) { struct lxc_list *it; struct id_map *map; unsigned int freeid = 0; again: lxc_list_for_each(it, &conf->id_map) { map = it->elem; if (map->idtype != idtype) continue; if (freeid >= map->nsid && freeid < map->nsid + map->range) { freeid =...
null
0
int find_unmapped_nsuid(struct lxc_conf *conf, enum idtype idtype) { struct lxc_list *it; struct id_map *map; unsigned int freeid = 0; again: lxc_list_for_each(it, &conf->id_map) { map = it->elem; if (map->idtype != idtype) continue; if (freeid >= map->nsid && freeid < map->nsid + map->range) { freeid =...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,715
static char *get_field(char *src, int nfields) { char *p = src; int i; for (i = 0; i < nfields; i++) { while (*p && *p != ' ' && *p != '\t') p++; if (!*p) break; p++; } return p; }
null
0
static char *get_field(char *src, int nfields) { char *p = src; int i; for (i = 0; i < nfields; i++) { while (*p && *p != ' ' && *p != '\t') p++; if (!*p) break; p++; } return p; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,716
bool get_mapped_rootid(struct lxc_conf *conf, enum idtype idtype, unsigned long *val) { struct lxc_list *it; struct id_map *map; lxc_list_for_each(it, &conf->id_map) { map = it->elem; if (map->idtype != idtype) continue; if (map->nsid != 0) continue; *val = map->hostid; return true; } return fa...
null
0
bool get_mapped_rootid(struct lxc_conf *conf, enum idtype idtype, unsigned long *val) { struct lxc_list *it; struct id_map *map; lxc_list_for_each(it, &conf->id_map) { map = it->elem; if (map->idtype != idtype) continue; if (map->nsid != 0) continue; *val = map->hostid; return true; } return fa...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,717
static char *getgname(void) { struct group *result; result = getgrgid(getegid()); if (!result) return NULL; return strdup(result->gr_name); }
null
0
static char *getgname(void) { struct group *result; result = getgrgid(getegid()); if (!result) return NULL; return strdup(result->gr_name); }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,718
static char* getuname(void) { struct passwd *result; result = getpwuid(geteuid()); if (!result) return NULL; return strdup(result->pw_name); }
null
0
static char* getuname(void) { struct passwd *result; result = getpwuid(geteuid()); if (!result) return NULL; return strdup(result->pw_name); }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,719
static struct lxc_list *idmap_add_id(struct lxc_conf *conf, uid_t uid, gid_t gid) { int hostuid_mapped = mapped_hostid(uid, conf, ID_TYPE_UID); int hostgid_mapped = mapped_hostid(gid, conf, ID_TYPE_GID); struct lxc_list *new = NULL, *tmp, *it, *next; struct id_map *entry; new = malloc(sizeof(*new)); if (!new) ...
null
0
static struct lxc_list *idmap_add_id(struct lxc_conf *conf, uid_t uid, gid_t gid) { int hostuid_mapped = mapped_hostid(uid, conf, ID_TYPE_UID); int hostgid_mapped = mapped_hostid(gid, conf, ID_TYPE_GID); struct lxc_list *new = NULL, *tmp, *it, *next; struct id_map *entry; new = malloc(sizeof(*new)); if (!new) ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,720
int in_caplist(int cap, struct lxc_list *caps) { struct lxc_list *iterator; int capid; lxc_list_for_each(iterator, caps) { capid = parse_cap(iterator->elem); if (capid == cap) return 1; } return 0; }
null
0
int in_caplist(int cap, struct lxc_list *caps) { struct lxc_list *iterator; int capid; lxc_list_for_each(iterator, caps) { capid = parse_cap(iterator->elem); if (capid == cap) return 1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,721
static int instantiate_empty(struct lxc_handler *handler, struct lxc_netdev *netdev) { netdev->ifindex = 0; if (netdev->upscript) { int err; err = run_script(handler->name, "net", netdev->upscript, "up", "empty", (char*) NULL); if (err) return -1; } return 0; }
null
0
static int instantiate_empty(struct lxc_handler *handler, struct lxc_netdev *netdev) { netdev->ifindex = 0; if (netdev->upscript) { int err; err = run_script(handler->name, "net", netdev->upscript, "up", "empty", (char*) NULL); if (err) return -1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,722
static int instantiate_macvlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { char peerbuf[IFNAMSIZ], *peer; int err; if (!netdev->link) { ERROR("no link specified for macvlan netdev"); return -1; } err = snprintf(peerbuf, sizeof(peerbuf), "mcXXXXXX"); if (err >= sizeof(peerbuf)) return -1; p...
null
0
static int instantiate_macvlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { char peerbuf[IFNAMSIZ], *peer; int err; if (!netdev->link) { ERROR("no link specified for macvlan netdev"); return -1; } err = snprintf(peerbuf, sizeof(peerbuf), "mcXXXXXX"); if (err >= sizeof(peerbuf)) return -1; p...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,723
static int instantiate_none(struct lxc_handler *handler, struct lxc_netdev *netdev) { netdev->ifindex = 0; return 0; }
null
0
static int instantiate_none(struct lxc_handler *handler, struct lxc_netdev *netdev) { netdev->ifindex = 0; return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,724
static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netdev) { if (!netdev->link) { ERROR("no link specified for the physical interface"); return -1; } netdev->ifindex = if_nametoindex(netdev->link); if (!netdev->ifindex) { ERROR("failed to retrieve the index for %s", netdev->link); ...
null
0
static int instantiate_phys(struct lxc_handler *handler, struct lxc_netdev *netdev) { if (!netdev->link) { ERROR("no link specified for the physical interface"); return -1; } netdev->ifindex = if_nametoindex(netdev->link); if (!netdev->ifindex) { ERROR("failed to retrieve the index for %s", netdev->link); ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,725
static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netdev) { char veth1buf[IFNAMSIZ], *veth1; char veth2buf[IFNAMSIZ], *veth2; int err, mtu = 0; if (netdev->priv.veth_attr.pair) { veth1 = netdev->priv.veth_attr.pair; if (handler->conf->reboot) lxc_netdev_delete_by_name(veth1); } el...
null
0
static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netdev) { char veth1buf[IFNAMSIZ], *veth1; char veth2buf[IFNAMSIZ], *veth2; int err, mtu = 0; if (netdev->priv.veth_attr.pair) { veth1 = netdev->priv.veth_attr.pair; if (handler->conf->reboot) lxc_netdev_delete_by_name(veth1); } el...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,726
static int instantiate_vlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { char peer[IFNAMSIZ]; int err; static uint16_t vlan_cntr = 0; if (!netdev->link) { ERROR("no link specified for vlan netdev"); return -1; } err = snprintf(peer, sizeof(peer), "vlan%d-%d", netdev->priv.vlan_attr.vid, vlan_cn...
null
0
static int instantiate_vlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { char peer[IFNAMSIZ]; int err; static uint16_t vlan_cntr = 0; if (!netdev->link) { ERROR("no link specified for vlan netdev"); return -1; } err = snprintf(peer, sizeof(peer), "vlan%d-%d", netdev->priv.vlan_attr.vid, vlan_cn...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,727
int lxc_assign_network(struct lxc_list *network, pid_t pid) { struct lxc_list *iterator; struct lxc_netdev *netdev; int am_root = (getuid() == 0); int err; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (netdev->type == LXC_NET_VETH && !am_root) { if (unpriv_assign_nic(netdev, pid)) ...
null
0
int lxc_assign_network(struct lxc_list *network, pid_t pid) { struct lxc_list *iterator; struct lxc_netdev *netdev; int am_root = (getuid() == 0); int err; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (netdev->type == LXC_NET_VETH && !am_root) { if (unpriv_assign_nic(netdev, pid)) ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,728
static inline void lxc_clear_aliens(struct lxc_conf *conf) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &conf->aliens, next) { lxc_list_del(it); free(it->elem); free(it); } }
null
0
static inline void lxc_clear_aliens(struct lxc_conf *conf) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &conf->aliens, next) { lxc_list_del(it); free(it->elem); free(it); } }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,729
int lxc_clear_automounts(struct lxc_conf *c) { c->auto_mounts = 0; return 0; }
null
0
int lxc_clear_automounts(struct lxc_conf *c) { c->auto_mounts = 0; return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,730
int lxc_clear_cgroups(struct lxc_conf *c, const char *key) { struct lxc_list *it,*next; bool all = false; const char *k = key + 11; if (strcmp(key, "lxc.cgroup") == 0) all = true; lxc_list_for_each_safe(it, &c->cgroup, next) { struct lxc_cgroup *cg = it->elem; if (!all && strcmp(cg->subsystem, k) != 0) ...
null
0
int lxc_clear_cgroups(struct lxc_conf *c, const char *key) { struct lxc_list *it,*next; bool all = false; const char *k = key + 11; if (strcmp(key, "lxc.cgroup") == 0) all = true; lxc_list_for_each_safe(it, &c->cgroup, next) { struct lxc_cgroup *cg = it->elem; if (!all && strcmp(cg->subsystem, k) != 0) ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,731
int lxc_clear_config_caps(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->caps, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
null
0
int lxc_clear_config_caps(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->caps, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,732
int lxc_clear_config_network(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->network, next) { lxc_remove_nic(it); } return 0; }
null
0
int lxc_clear_config_network(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->network, next) { lxc_remove_nic(it); } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,733
int lxc_clear_environment(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->environment, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
null
0
int lxc_clear_environment(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->environment, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,734
int lxc_clear_groups(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->groups, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
null
0
int lxc_clear_groups(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->groups, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,735
int lxc_clear_hooks(struct lxc_conf *c, const char *key) { struct lxc_list *it,*next; bool all = false, done = false; const char *k = key + 9; int i; if (strcmp(key, "lxc.hook") == 0) all = true; for (i=0; i<NUM_LXC_HOOKS; i++) { if (all || strcmp(k, lxchook_names[i]) == 0) { lxc_list_for_each_safe(it, &...
null
0
int lxc_clear_hooks(struct lxc_conf *c, const char *key) { struct lxc_list *it,*next; bool all = false, done = false; const char *k = key + 9; int i; if (strcmp(key, "lxc.hook") == 0) all = true; for (i=0; i<NUM_LXC_HOOKS; i++) { if (all || strcmp(k, lxchook_names[i]) == 0) { lxc_list_for_each_safe(it, &...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,736
static inline void lxc_clear_includes(struct lxc_conf *conf) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &conf->includes, next) { lxc_list_del(it); free(it->elem); free(it); } }
null
0
static inline void lxc_clear_includes(struct lxc_conf *conf) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &conf->includes, next) { lxc_list_del(it); free(it->elem); free(it); } }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,737
int lxc_clear_mount_entries(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->mount_list, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
null
0
int lxc_clear_mount_entries(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->mount_list, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,738
int lxc_clear_nic(struct lxc_conf *c, const char *key) { char *p1; int ret, idx, i; struct lxc_list *it; struct lxc_netdev *netdev; p1 = strchr(key, '.'); if (!p1 || *(p1+1) == '\0') p1 = NULL; ret = sscanf(key, "%d", &idx); if (ret != 1) return -1; if (idx < 0) return -1; i = 0; lxc_list_for_each(it,...
null
0
int lxc_clear_nic(struct lxc_conf *c, const char *key) { char *p1; int ret, idx, i; struct lxc_list *it; struct lxc_netdev *netdev; p1 = strchr(key, '.'); if (!p1 || *(p1+1) == '\0') p1 = NULL; ret = sscanf(key, "%d", &idx); if (ret != 1) return -1; if (idx < 0) return -1; i = 0; lxc_list_for_each(it,...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,739
static void lxc_clear_saved_nics(struct lxc_conf *conf) { int i; if (!conf->saved_nics) return; for (i=0; i < conf->num_savednics; i++) free(conf->saved_nics[i].orig_name); free(conf->saved_nics); }
null
0
static void lxc_clear_saved_nics(struct lxc_conf *conf) { int i; if (!conf->saved_nics) return; for (i=0; i < conf->num_savednics; i++) free(conf->saved_nics[i].orig_name); free(conf->saved_nics); }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,740
void lxc_conf_free(struct lxc_conf *conf) { if (!conf) return; if (current_config == conf) current_config = NULL; free(conf->console.log_path); free(conf->console.path); free(conf->rootfs.mount); free(conf->rootfs.options); free(conf->rootfs.path); free(conf->rootfs.pivot); free(conf->logfile); if (conf->...
null
0
void lxc_conf_free(struct lxc_conf *conf) { if (!conf) return; if (current_config == conf) current_config = NULL; free(conf->console.log_path); free(conf->console.path); free(conf->rootfs.mount); free(conf->rootfs.options); free(conf->rootfs.path); free(conf->rootfs.pivot); free(conf->logfile); if (conf->...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,741
int lxc_create_network(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; int am_root = (getuid() == 0); if (!am_root) return 0; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (netdev->type < 0 || n...
null
0
int lxc_create_network(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; int am_root = (getuid() == 0); if (!am_root) return 0; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (netdev->type < 0 || n...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,742
int lxc_create_tty(const char *name, struct lxc_conf *conf) { struct lxc_tty_info *tty_info = &conf->tty_info; int i, ret; /* no tty in the configuration */ if (!conf->tty) return 0; tty_info->pty_info = malloc(sizeof(*tty_info->pty_info)*conf->tty); if (!tty_info->pty_info) { SYSERROR("failed to allocate...
null
0
int lxc_create_tty(const char *name, struct lxc_conf *conf) { struct lxc_tty_info *tty_info = &conf->tty_info; int i, ret; /* no tty in the configuration */ if (!conf->tty) return 0; tty_info->pty_info = malloc(sizeof(*tty_info->pty_info)*conf->tty); if (!tty_info->pty_info) { SYSERROR("failed to allocate...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,743
void lxc_delete_network(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (netdev->ifindex != 0 && netdev->type == LXC_NET_PHYS) { if (lxc_netdev_rename_...
null
0
void lxc_delete_network(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (netdev->ifindex != 0 && netdev->type == LXC_NET_PHYS) { if (lxc_netdev_rename_...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,744
void lxc_delete_tty(struct lxc_tty_info *tty_info) { int i; for (i = 0; i < tty_info->nbtty; i++) { struct lxc_pty_info *pty_info = &tty_info->pty_info[i]; close(pty_info->master); close(pty_info->slave); } free(tty_info->pty_info); tty_info->nbtty = 0; }
null
0
void lxc_delete_tty(struct lxc_tty_info *tty_info) { int i; for (i = 0; i < tty_info->nbtty; i++) { struct lxc_pty_info *pty_info = &tty_info->pty_info[i]; close(pty_info->master); close(pty_info->slave); } free(tty_info->pty_info); tty_info->nbtty = 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,745
int lxc_find_gateway_addresses(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; int link_index; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (!netdev->ipv4_gateway_auto && !netdev->ipv6_gateway_auto)...
null
0
int lxc_find_gateway_addresses(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; int link_index; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (!netdev->ipv4_gateway_auto && !netdev->ipv6_gateway_auto)...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,746
static int lxc_free_idmap(struct lxc_list *id_map) { struct lxc_list *it, *next; lxc_list_for_each_safe(it, id_map, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
null
0
static int lxc_free_idmap(struct lxc_list *id_map) { struct lxc_list *it, *next; lxc_list_for_each_safe(it, id_map, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,747
int lxc_map_ids(struct lxc_list *idmap, pid_t pid) { struct lxc_list *iterator; struct id_map *map; int ret = 0, use_shadow = 0; enum idtype type; char *buf = NULL, *pos, *cmdpath = NULL; /* * If newuidmap exists, that is, if shadow is handing out subuid * ranges, then insist that root also reserve ranges in...
null
0
int lxc_map_ids(struct lxc_list *idmap, pid_t pid) { struct lxc_list *iterator; struct id_map *map; int ret = 0, use_shadow = 0; enum idtype type; char *buf = NULL, *pos, *cmdpath = NULL; /* * If newuidmap exists, that is, if shadow is handing out subuid * ranges, then insist that root also reserve ranges in...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,748
static void lxc_remove_nic(struct lxc_list *it) { struct lxc_netdev *netdev = it->elem; struct lxc_list *it2,*next; lxc_list_del(it); free(netdev->link); free(netdev->name); if (netdev->type == LXC_NET_VETH) free(netdev->priv.veth_attr.pair); free(netdev->upscript); free(netdev->hwaddr); free(netdev->mtu);...
null
0
static void lxc_remove_nic(struct lxc_list *it) { struct lxc_netdev *netdev = it->elem; struct lxc_list *it2,*next; lxc_list_del(it); free(netdev->link); free(netdev->name); if (netdev->type == LXC_NET_VETH) free(netdev->priv.veth_attr.pair); free(netdev->upscript); free(netdev->hwaddr); free(netdev->mtu);...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,749
void lxc_rename_phys_nics_on_shutdown(int netnsfd, struct lxc_conf *conf) { int i; if (conf->num_savednics == 0) return; INFO("running to reset %d nic names", conf->num_savednics); restore_phys_nics_to_netns(netnsfd, conf); for (i=0; i<conf->num_savednics; i++) { struct saved_nic *s = &conf->saved_nics[i]; ...
null
0
void lxc_rename_phys_nics_on_shutdown(int netnsfd, struct lxc_conf *conf) { int i; if (conf->num_savednics == 0) return; INFO("running to reset %d nic names", conf->num_savednics); restore_phys_nics_to_netns(netnsfd, conf); for (i=0; i<conf->num_savednics; i++) { struct saved_nic *s = &conf->saved_nics[i]; ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,750
int lxc_requests_empty_network(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; bool found_none = false, found_nic = false; if (lxc_list_empty(network)) return 0; lxc_list_for_each(iterator, network) { netdev = iterator...
null
0
int lxc_requests_empty_network(struct lxc_handler *handler) { struct lxc_list *network = &handler->conf->network; struct lxc_list *iterator; struct lxc_netdev *netdev; bool found_none = false, found_nic = false; if (lxc_list_empty(network)) return 0; lxc_list_for_each(iterator, network) { netdev = iterator...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,751
int mapped_hostid(unsigned id, struct lxc_conf *conf, enum idtype idtype) { struct lxc_list *it; struct id_map *map; lxc_list_for_each(it, &conf->id_map) { map = it->elem; if (map->idtype != idtype) continue; if (id >= map->hostid && id < map->hostid + map->range) return (id - map->hostid) + map->nsid; ...
null
0
int mapped_hostid(unsigned id, struct lxc_conf *conf, enum idtype idtype) { struct lxc_list *it; struct id_map *map; lxc_list_for_each(it, &conf->id_map) { map = it->elem; if (map->idtype != idtype) continue; if (id >= map->hostid && id < map->hostid + map->range) return (id - map->hostid) + map->nsid; ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,752
static int mount_entry_create_dir_file(const struct mntent *mntent, const char* path) { char *pathdirname = NULL; int ret = 0; FILE *pathfile = NULL; if (hasmntopt(mntent, "create=dir")) { if (mkdir_p(path, 0755) < 0) { WARN("Failed to create mount target '%s'", path); ret = -1; } } if (has...
null
0
static int mount_entry_create_dir_file(const struct mntent *mntent, const char* path) { char *pathdirname = NULL; int ret = 0; FILE *pathfile = NULL; if (hasmntopt(mntent, "create=dir")) { if (mkdir_p(path, 0755) < 0) { WARN("Failed to create mount target '%s'", path); ret = -1; } } if (has...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,753
static int mount_rootfs(const char *rootfs, const char *target, const char *options) { char absrootfs[MAXPATHLEN]; struct stat s; int i; typedef int (*rootfs_cb)(const char *, const char *, const char *); struct rootfs_type { int type; rootfs_cb cb; } rtfs_type[] = { { S_IFDIR, mount_rootfs_dir }, { S_I...
null
0
static int mount_rootfs(const char *rootfs, const char *target, const char *options) { char absrootfs[MAXPATHLEN]; struct stat s; int i; typedef int (*rootfs_cb)(const char *, const char *, const char *); struct rootfs_type { int type; rootfs_cb cb; } rtfs_type[] = { { S_IFDIR, mount_rootfs_dir }, { S_I...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,754
static int mount_rootfs_dir(const char *rootfs, const char *target, const char *options) { unsigned long mntflags; char *mntdata; int ret; if (parse_mntopts(options, &mntflags, &mntdata) < 0) { free(mntdata); return -1; } ret = mount(rootfs, target, "none", MS_BIND | MS_REC | mntflags, mn...
null
0
static int mount_rootfs_dir(const char *rootfs, const char *target, const char *options) { unsigned long mntflags; char *mntdata; int ret; if (parse_mntopts(options, &mntflags, &mntdata) < 0) { free(mntdata); return -1; } ret = mount(rootfs, target, "none", MS_BIND | MS_REC | mntflags, mn...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,755
static int mount_rootfs_file(const char *rootfs, const char *target, const char *options) { struct dirent dirent, *direntp; struct loop_info64 loinfo; int ret = -1, fd = -1, rc; DIR *dir; char path[MAXPATHLEN]; dir = opendir("/dev"); if (!dir) { SYSERROR("failed to open '/dev'"); return -1;...
null
0
static int mount_rootfs_file(const char *rootfs, const char *target, const char *options) { struct dirent dirent, *direntp; struct loop_info64 loinfo; int ret = -1, fd = -1, rc; DIR *dir; char path[MAXPATHLEN]; dir = opendir("/dev"); if (!dir) { SYSERROR("failed to open '/dev'"); return -1;...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,756
static void null_endofword(char *word) { while (*word && *word != ' ' && *word != '\t') word++; *word = '\0'; }
null
0
static void null_endofword(char *word) { while (*word && *word != ' ' && *word != '\t') word++; *word = '\0'; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,757
static int parse_cap(const char *cap) { char *ptr = NULL; int i, capid = -1; if (!strcmp(cap, "none")) return -2; for (i = 0; i < sizeof(caps_opt)/sizeof(caps_opt[0]); i++) { if (strcmp(cap, caps_opt[i].name)) continue; capid = caps_opt[i].value; break; } if (capid < 0) { /* try to see if it's n...
null
0
static int parse_cap(const char *cap) { char *ptr = NULL; int i, capid = -1; if (!strcmp(cap, "none")) return -2; for (i = 0; i < sizeof(caps_opt)/sizeof(caps_opt[0]); i++) { if (strcmp(cap, caps_opt[i].name)) continue; capid = caps_opt[i].value; break; } if (capid < 0) { /* try to see if it's n...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,758
int parse_mntopts(const char *mntopts, unsigned long *mntflags, char **mntdata) { char *s, *data; char *p, *saveptr = NULL; *mntdata = NULL; *mntflags = 0L; if (!mntopts) return 0; s = strdup(mntopts); if (!s) { SYSERROR("failed to allocate memory"); return -1; } data = malloc(strlen(s) + 1); if...
null
0
int parse_mntopts(const char *mntopts, unsigned long *mntflags, char **mntdata) { char *s, *data; char *p, *saveptr = NULL; *mntdata = NULL; *mntflags = 0L; if (!mntopts) return 0; s = strdup(mntopts); if (!s) { SYSERROR("failed to allocate memory"); return -1; } data = malloc(strlen(s) + 1); if...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,759
int pin_rootfs(const char *rootfs) { char absrootfs[MAXPATHLEN]; char absrootfspin[MAXPATHLEN]; struct stat s; int ret, fd; if (rootfs == NULL || strlen(rootfs) == 0) return -2; if (!realpath(rootfs, absrootfs)) return -2; if (access(absrootfs, F_OK)) return -1; if (stat(absrootfs, &s)) return -1; ...
null
0
int pin_rootfs(const char *rootfs) { char absrootfs[MAXPATHLEN]; char absrootfspin[MAXPATHLEN]; struct stat s; int ret, fd; if (rootfs == NULL || strlen(rootfs) == 0) return -2; if (!realpath(rootfs, absrootfs)) return -2; if (access(absrootfs, F_OK)) return -1; if (stat(absrootfs, &s)) return -1; ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,760
static int pivot_root(const char * new_root, const char * put_old) { #ifdef __NR_pivot_root return syscall(__NR_pivot_root, new_root, put_old); #else errno = ENOSYS; return -1; #endif }
null
0
static int pivot_root(const char * new_root, const char * put_old) { #ifdef __NR_pivot_root return syscall(__NR_pivot_root, new_root, put_old); #else errno = ENOSYS; return -1; #endif }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,761
int prepare_ramfs_root(char *root) { char buf[LINELEN], *p; char nroot[PATH_MAX]; FILE *f; int i; char *p2; if (realpath(root, nroot) == NULL) return -1; if (chdir("/") == -1) return -1; /* * We could use here MS_MOVE, but in userns this mount is * locked and can't be moved. */ if (mount(root, "/"...
null
0
int prepare_ramfs_root(char *root) { char buf[LINELEN], *p; char nroot[PATH_MAX]; FILE *f; int i; char *p2; if (realpath(root, nroot) == NULL) return -1; if (chdir("/") == -1) return -1; /* * We could use here MS_MOVE, but in userns this mount is * locked and can't be moved. */ if (mount(root, "/"...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,762
void remount_all_slave(void) { /* walk /proc/mounts and change any shared entries to slave */ FILE *f = fopen("/proc/self/mountinfo", "r"); char *line = NULL; size_t len = 0; if (!f) { SYSERROR("Failed to open /proc/self/mountinfo to mark all shared"); ERROR("Continuing container startup..."); return; } ...
null
0
void remount_all_slave(void) { /* walk /proc/mounts and change any shared entries to slave */ FILE *f = fopen("/proc/self/mountinfo", "r"); char *line = NULL; size_t len = 0; if (!f) { SYSERROR("Failed to open /proc/self/mountinfo to mark all shared"); ERROR("Continuing container startup..."); return; } ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,763
void restore_phys_nics_to_netns(int netnsfd, struct lxc_conf *conf) { int i, ret, oldfd; char path[MAXPATHLEN]; if (netnsfd < 0) return; ret = snprintf(path, MAXPATHLEN, "/proc/self/ns/net"); if (ret < 0 || ret >= MAXPATHLEN) { WARN("Failed to open monitor netns fd"); return; } if ((oldfd = open(path, O_...
null
0
void restore_phys_nics_to_netns(int netnsfd, struct lxc_conf *conf) { int i, ret, oldfd; char path[MAXPATHLEN]; if (netnsfd < 0) return; ret = snprintf(path, MAXPATHLEN, "/proc/self/ns/net"); if (ret < 0 || ret >= MAXPATHLEN) { WARN("Failed to open monitor netns fd"); return; } if ((oldfd = open(path, O_...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,764
static int run_buffer(char *buffer) { struct lxc_popen_FILE *f; char *output; int ret; f = lxc_popen(buffer); if (!f) { SYSERROR("popen failed"); return -1; } output = malloc(LXC_LOG_BUFFER_SIZE); if (!output) { ERROR("failed to allocate memory for script output"); lxc_pclose(f); return -1; } whi...
null
0
static int run_buffer(char *buffer) { struct lxc_popen_FILE *f; char *output; int ret; f = lxc_popen(buffer); if (!f) { SYSERROR("popen failed"); return -1; } output = malloc(LXC_LOG_BUFFER_SIZE); if (!output) { ERROR("failed to allocate memory for script output"); lxc_pclose(f); return -1; } whi...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,765
int run_lxc_hooks(const char *name, char *hook, struct lxc_conf *conf, const char *lxcpath, char *argv[]) { int which = -1; struct lxc_list *it; if (strcmp(hook, "pre-start") == 0) which = LXCHOOK_PRESTART; else if (strcmp(hook, "pre-mount") == 0) which = LXCHOOK_PREMOUNT; else if (strcmp(hook, "mount") =...
null
0
int run_lxc_hooks(const char *name, char *hook, struct lxc_conf *conf, const char *lxcpath, char *argv[]) { int which = -1; struct lxc_list *it; if (strcmp(hook, "pre-start") == 0) which = LXCHOOK_PRESTART; else if (strcmp(hook, "pre-mount") == 0) which = LXCHOOK_PREMOUNT; else if (strcmp(hook, "mount") =...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,766
static int run_script(const char *name, const char *section, const char *script, ...) { int ret; char *buffer, *p; size_t size = 0; va_list ap; INFO("Executing script '%s' for container '%s', config section '%s'", script, name, section); va_start(ap, script); while ((p = va_arg(ap, char *))) si...
null
0
static int run_script(const char *name, const char *section, const char *script, ...) { int ret; char *buffer, *p; size_t size = 0; va_list ap; INFO("Executing script '%s' for container '%s', config section '%s'", script, name, section); va_start(ap, script); while ((p = va_arg(ap, char *))) si...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,767
static int run_script_argv(const char *name, const char *section, const char *script, const char *hook, const char *lxcpath, char **argsin) { int ret, i; char *buffer; size_t size = 0; INFO("Executing script '%s' for container '%s', config section '%s'", script, name, section); for (i=0; ar...
null
0
static int run_script_argv(const char *name, const char *section, const char *script, const char *hook, const char *lxcpath, char **argsin) { int ret, i; char *buffer; size_t size = 0; INFO("Executing script '%s' for container '%s', config section '%s'", script, name, section); for (i=0; ar...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,768
static int run_userns_fn(void *data) { struct userns_fn_data *d = data; char c; close(d->p[1]); if (read(d->p[0], &c, 1) != 1) return -1; close(d->p[0]); return d->fn(d->arg); }
null
0
static int run_userns_fn(void *data) { struct userns_fn_data *d = data; char c; close(d->p[1]); if (read(d->p[0], &c, 1) != 1) return -1; close(d->p[0]); return d->fn(d->arg); }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,769
static int send_fd(int sock, int fd) { int ret = lxc_abstract_unix_send_fd(sock, fd, NULL, 0); if (ret < 0) { SYSERROR("Error sending tty fd to parent"); return -1; } return 0; }
null
0
static int send_fd(int sock, int fd) { int ret = lxc_abstract_unix_send_fd(sock, fd, NULL, 0); if (ret < 0) { SYSERROR("Error sending tty fd to parent"); return -1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,770
static int sethostname(const char * name, size_t len) { #ifdef __NR_sethostname return syscall(__NR_sethostname, name, len); #else errno = ENOSYS; return -1; #endif }
null
0
static int sethostname(const char * name, size_t len) { #ifdef __NR_sethostname return syscall(__NR_sethostname, name, len); #else errno = ENOSYS; return -1; #endif }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,771
static int setup_caps(struct lxc_list *caps) { struct lxc_list *iterator; char *drop_entry; int capid; lxc_list_for_each(iterator, caps) { drop_entry = iterator->elem; capid = parse_cap(drop_entry); if (capid < 0) { ERROR("unknown capability %s", drop_entry); return -1; } DEBUG("drop cap...
null
0
static int setup_caps(struct lxc_list *caps) { struct lxc_list *iterator; char *drop_entry; int capid; lxc_list_for_each(iterator, caps) { drop_entry = iterator->elem; capid = parse_cap(drop_entry); if (capid < 0) { ERROR("unknown capability %s", drop_entry); return -1; } DEBUG("drop cap...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,772
static int setup_console(const struct lxc_rootfs *rootfs, const struct lxc_console *console, char *ttydir) { /* We don't have a rootfs, /dev/console will be shared */ if (!rootfs->path) return 0; if (!ttydir) return setup_dev_console(rootfs, console); return setup_ttydir_console(rootfs, console, ttydir...
null
0
static int setup_console(const struct lxc_rootfs *rootfs, const struct lxc_console *console, char *ttydir) { /* We don't have a rootfs, /dev/console will be shared */ if (!rootfs->path) return 0; if (!ttydir) return setup_dev_console(rootfs, console); return setup_ttydir_console(rootfs, console, ttydir...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,773
static int setup_dev_symlinks(const struct lxc_rootfs *rootfs) { char path[MAXPATHLEN]; int ret,i; struct stat s; for (i = 0; i < sizeof(dev_symlinks) / sizeof(dev_symlinks[0]); i++) { const struct dev_symlinks *d = &dev_symlinks[i]; ret = snprintf(path, sizeof(path), "%s/dev/%s", rootfs->path ? rootfs->mount...
null
0
static int setup_dev_symlinks(const struct lxc_rootfs *rootfs) { char path[MAXPATHLEN]; int ret,i; struct stat s; for (i = 0; i < sizeof(dev_symlinks) / sizeof(dev_symlinks[0]); i++) { const struct dev_symlinks *d = &dev_symlinks[i]; ret = snprintf(path, sizeof(path), "%s/dev/%s", rootfs->path ? rootfs->mount...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,774
static int setup_hw_addr(char *hwaddr, const char *ifname) { struct sockaddr sockaddr; struct ifreq ifr; int ret, fd; ret = lxc_convert_mac(hwaddr, &sockaddr); if (ret) { ERROR("mac address '%s' conversion failed : %s", hwaddr, strerror(-ret)); return -1; } memcpy(ifr.ifr_name, ifname, IFNAMSIZ); ...
null
0
static int setup_hw_addr(char *hwaddr, const char *ifname) { struct sockaddr sockaddr; struct ifreq ifr; int ret, fd; ret = lxc_convert_mac(hwaddr, &sockaddr); if (ret) { ERROR("mac address '%s' conversion failed : %s", hwaddr, strerror(-ret)); return -1; } memcpy(ifr.ifr_name, ifname, IFNAMSIZ); ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,775
static int setup_ipv4_addr(struct lxc_list *ip, int ifindex) { struct lxc_list *iterator; struct lxc_inetdev *inetdev; int err; lxc_list_for_each(iterator, ip) { inetdev = iterator->elem; err = lxc_ipv4_addr_add(ifindex, &inetdev->addr, &inetdev->bcast, inetdev->prefix); if (err) { ERROR("failed to...
null
0
static int setup_ipv4_addr(struct lxc_list *ip, int ifindex) { struct lxc_list *iterator; struct lxc_inetdev *inetdev; int err; lxc_list_for_each(iterator, ip) { inetdev = iterator->elem; err = lxc_ipv4_addr_add(ifindex, &inetdev->addr, &inetdev->bcast, inetdev->prefix); if (err) { ERROR("failed to...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,776
static int setup_ipv6_addr(struct lxc_list *ip, int ifindex) { struct lxc_list *iterator; struct lxc_inet6dev *inet6dev; int err; lxc_list_for_each(iterator, ip) { inet6dev = iterator->elem; err = lxc_ipv6_addr_add(ifindex, &inet6dev->addr, &inet6dev->mcast, &inet6dev->acast, inet6dev->prefix); i...
null
0
static int setup_ipv6_addr(struct lxc_list *ip, int ifindex) { struct lxc_list *iterator; struct lxc_inet6dev *inet6dev; int err; lxc_list_for_each(iterator, ip) { inet6dev = iterator->elem; err = lxc_ipv6_addr_add(ifindex, &inet6dev->addr, &inet6dev->mcast, &inet6dev->acast, inet6dev->prefix); i...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,777
static int setup_kmsg(const struct lxc_rootfs *rootfs, const struct lxc_console *console) { char kpath[MAXPATHLEN]; int ret; if (!rootfs->path) return 0; ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount); if (ret < 0 || ret >= sizeof(kpath)) return -1; ret = unlink(kpath); if (ret...
null
0
static int setup_kmsg(const struct lxc_rootfs *rootfs, const struct lxc_console *console) { char kpath[MAXPATHLEN]; int ret; if (!rootfs->path) return 0; ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount); if (ret < 0 || ret >= sizeof(kpath)) return -1; ret = unlink(kpath); if (ret...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,778
static int setup_mount(const struct lxc_rootfs *rootfs, const char *fstab, const char *lxc_name) { FILE *file; int ret; if (!fstab) return 0; file = setmntent(fstab, "r"); if (!file) { SYSERROR("failed to use '%s'", fstab); return -1; } ret = mount_file_entries(rootfs, file, lxc_name); endmntent(file...
null
0
static int setup_mount(const struct lxc_rootfs *rootfs, const char *fstab, const char *lxc_name) { FILE *file; int ret; if (!fstab) return 0; file = setmntent(fstab, "r"); if (!file) { SYSERROR("failed to use '%s'", fstab); return -1; } ret = mount_file_entries(rootfs, file, lxc_name); endmntent(file...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,779
static int setup_mount_entries(const struct lxc_rootfs *rootfs, struct lxc_list *mount, const char *lxc_name) { FILE *file; int ret; file = write_mount_file(mount); if (!file) return -1; ret = mount_file_entries(rootfs, file, lxc_name); fclose(file); return ret; }
null
0
static int setup_mount_entries(const struct lxc_rootfs *rootfs, struct lxc_list *mount, const char *lxc_name) { FILE *file; int ret; file = write_mount_file(mount); if (!file) return -1; ret = mount_file_entries(rootfs, file, lxc_name); fclose(file); return ret; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,780
static int setup_netdev(struct lxc_netdev *netdev) { char ifname[IFNAMSIZ]; char *current_ifname = ifname; int err; /* empty network namespace */ if (!netdev->ifindex) { if (netdev->flags & IFF_UP) { err = lxc_netdev_up("lo"); if (err) { ERROR("failed to set the loopback up : %s", strerror(-...
null
0
static int setup_netdev(struct lxc_netdev *netdev) { char ifname[IFNAMSIZ]; char *current_ifname = ifname; int err; /* empty network namespace */ if (!netdev->ifindex) { if (netdev->flags & IFF_UP) { err = lxc_netdev_up("lo"); if (err) { ERROR("failed to set the loopback up : %s", strerror(-...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,781
static int setup_network(struct lxc_list *network) { struct lxc_list *iterator; struct lxc_netdev *netdev; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (setup_netdev(netdev)) { ERROR("failed to setup netdev"); return -1; } } if (!lxc_list_empty(network)) INFO("network has be...
null
0
static int setup_network(struct lxc_list *network) { struct lxc_list *iterator; struct lxc_netdev *netdev; lxc_list_for_each(iterator, network) { netdev = iterator->elem; if (setup_netdev(netdev)) { ERROR("failed to setup netdev"); return -1; } } if (!lxc_list_empty(network)) INFO("network has be...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,782
static int setup_personality(int persona) { #if HAVE_SYS_PERSONALITY_H if (persona == -1) return 0; if (personality(persona) < 0) { SYSERROR("failed to set personality to '0x%x'", persona); return -1; } INFO("set personality to '0x%x'", persona); #endif return 0; }
null
0
static int setup_personality(int persona) { #if HAVE_SYS_PERSONALITY_H if (persona == -1) return 0; if (personality(persona) < 0) { SYSERROR("failed to set personality to '0x%x'", persona); return -1; } INFO("set personality to '0x%x'", persona); #endif return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,783
static int setup_pivot_root(const struct lxc_rootfs *rootfs) { if (!rootfs->path) return 0; if (detect_ramfs_rootfs()) { if (prepare_ramfs_root(rootfs->mount)) return -1; } else if (setup_rootfs_pivot_root(rootfs->mount, rootfs->pivot)) { ERROR("failed to setup pivot root"); return -1; } return 0; }
null
0
static int setup_pivot_root(const struct lxc_rootfs *rootfs) { if (!rootfs->path) return 0; if (detect_ramfs_rootfs()) { if (prepare_ramfs_root(rootfs->mount)) return -1; } else if (setup_rootfs_pivot_root(rootfs->mount, rootfs->pivot)) { ERROR("failed to setup pivot root"); return -1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,784
static int setup_rootfs(struct lxc_conf *conf) { const struct lxc_rootfs *rootfs = &conf->rootfs; if (!rootfs->path) { if (mount("", "/", NULL, MS_SLAVE|MS_REC, 0)) { SYSERROR("Failed to make / rslave"); return -1; } return 0; } if (access(rootfs->mount, F_OK)) { SYSERROR("failed to access to '%s', ...
null
0
static int setup_rootfs(struct lxc_conf *conf) { const struct lxc_rootfs *rootfs = &conf->rootfs; if (!rootfs->path) { if (mount("", "/", NULL, MS_SLAVE|MS_REC, 0)) { SYSERROR("Failed to make / rslave"); return -1; } return 0; } if (access(rootfs->mount, F_OK)) { SYSERROR("failed to access to '%s', ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,785
static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir) { int oldroot = -1, newroot = -1; oldroot = open("/", O_DIRECTORY | O_RDONLY); if (oldroot < 0) { SYSERROR("Error opening old-/ for fchdir"); return -1; } newroot = open(rootfs, O_DIRECTORY | O_RDONLY); if (newroot < 0) { SYSERROR...
null
0
static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir) { int oldroot = -1, newroot = -1; oldroot = open("/", O_DIRECTORY | O_RDONLY); if (oldroot < 0) { SYSERROR("Error opening old-/ for fchdir"); return -1; } newroot = open(rootfs, O_DIRECTORY | O_RDONLY); if (newroot < 0) { SYSERROR...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,786
static int setup_utsname(struct utsname *utsname) { if (!utsname) return 0; if (sethostname(utsname->nodename, strlen(utsname->nodename))) { SYSERROR("failed to set the hostname to '%s'", utsname->nodename); return -1; } INFO("'%s' hostname has been setup", utsname->nodename); return 0; }
null
0
static int setup_utsname(struct utsname *utsname) { if (!utsname) return 0; if (sethostname(utsname->nodename, strlen(utsname->nodename))) { SYSERROR("failed to set the hostname to '%s'", utsname->nodename); return -1; } INFO("'%s' hostname has been setup", utsname->nodename); return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,787
static int shutdown_empty(struct lxc_handler *handler, struct lxc_netdev *netdev) { int err; if (netdev->downscript) { err = run_script(handler->name, "net", netdev->downscript, "down", "empty", (char*) NULL); if (err) return -1; } return 0; }
null
0
static int shutdown_empty(struct lxc_handler *handler, struct lxc_netdev *netdev) { int err; if (netdev->downscript) { err = run_script(handler->name, "net", netdev->downscript, "down", "empty", (char*) NULL); if (err) return -1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,788
static int shutdown_macvlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { int err; if (netdev->downscript) { err = run_script(handler->name, "net", netdev->downscript, "down", "macvlan", netdev->link, (char*) NULL); if (err) return -1; } return 0; }
null
0
static int shutdown_macvlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { int err; if (netdev->downscript) { err = run_script(handler->name, "net", netdev->downscript, "down", "macvlan", netdev->link, (char*) NULL); if (err) return -1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,789
static int shutdown_none(struct lxc_handler *handler, struct lxc_netdev *netdev) { return 0; }
null
0
static int shutdown_none(struct lxc_handler *handler, struct lxc_netdev *netdev) { return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,790
static int shutdown_phys(struct lxc_handler *handler, struct lxc_netdev *netdev) { int err; if (netdev->downscript) { err = run_script(handler->name, "net", netdev->downscript, "down", "phys", netdev->link, (char*) NULL); if (err) return -1; } return 0; }
null
0
static int shutdown_phys(struct lxc_handler *handler, struct lxc_netdev *netdev) { int err; if (netdev->downscript) { err = run_script(handler->name, "net", netdev->downscript, "down", "phys", netdev->link, (char*) NULL); if (err) return -1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,791
static int shutdown_vlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { return 0; }
null
0
static int shutdown_vlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,792
struct lxc_list *sort_cgroup_settings(struct lxc_list* cgroup_settings) { struct lxc_list *result; struct lxc_list *memsw_limit = NULL; struct lxc_list *it = NULL; struct lxc_cgroup *cg = NULL; struct lxc_list *item = NULL; result = malloc(sizeof(*result)); if (!result) { ERROR("failed to allocate memory to s...
null
0
struct lxc_list *sort_cgroup_settings(struct lxc_list* cgroup_settings) { struct lxc_list *result; struct lxc_list *memsw_limit = NULL; struct lxc_list *it = NULL; struct lxc_cgroup *cg = NULL; struct lxc_list *item = NULL; result = malloc(sizeof(*result)); if (!result) { ERROR("failed to allocate memory to s...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,793
int tmp_proc_mount(struct lxc_conf *lxc_conf) { int mounted; mounted = mount_proc_if_needed(lxc_conf->rootfs.path ? lxc_conf->rootfs.mount : ""); if (mounted == -1) { SYSERROR("failed to mount /proc in the container."); /* continue only if there is no rootfs */ if (lxc_conf->rootfs.path) return -1; } else...
null
0
int tmp_proc_mount(struct lxc_conf *lxc_conf) { int mounted; mounted = mount_proc_if_needed(lxc_conf->rootfs.path ? lxc_conf->rootfs.mount : ""); if (mounted == -1) { SYSERROR("failed to mount /proc in the container."); /* continue only if there is no rootfs */ if (lxc_conf->rootfs.path) return -1; } else...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,794
int ttys_shift_ids(struct lxc_conf *c) { if (lxc_list_empty(&c->id_map)) return 0; if (strcmp(c->console.name, "") !=0 && chown_mapped_root(c->console.name, c) < 0) { ERROR("Failed to chown %s", c->console.name); return -1; } return 0; }
null
0
int ttys_shift_ids(struct lxc_conf *c) { if (lxc_list_empty(&c->id_map)) return 0; if (strcmp(c->console.name, "") !=0 && chown_mapped_root(c->console.name, c) < 0) { ERROR("Failed to chown %s", c->console.name); return -1; } return 0; }
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,795
static int unpriv_assign_nic(struct lxc_netdev *netdev, pid_t pid) { pid_t child; int bytes, pipefd[2]; char *token, *saveptr = NULL; char buffer[MAX_BUFFER_SIZE]; char netdev_link[IFNAMSIZ+1]; if (netdev->type != LXC_NET_VETH) { ERROR("nic type %d not support for unprivileged use", netdev->type); return ...
null
0
static int unpriv_assign_nic(struct lxc_netdev *netdev, pid_t pid) { pid_t child; int bytes, pipefd[2]; char *token, *saveptr = NULL; char buffer[MAX_BUFFER_SIZE]; char netdev_link[IFNAMSIZ+1]; if (netdev->type != LXC_NET_VETH) { ERROR("nic type %d not support for unprivileged use", netdev->type); return ...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,796
int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data) { int ret, pid; struct userns_fn_data d; char c = '1'; int p[2]; struct lxc_list *idmap; ret = pipe(p); if (ret < 0) { SYSERROR("opening pipe"); return -1; } d.fn = fn; d.arg = data; d.p[0] = p[0]; d.p[1] = p[1]; pid = lxc_clone(r...
null
0
int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data) { int ret, pid; struct userns_fn_data d; char c = '1'; int p[2]; struct lxc_list *idmap; ret = pipe(p); if (ret < 0) { SYSERROR("opening pipe"); return -1; } d.fn = fn; d.arg = data; d.p[0] = p[0]; d.p[1] = p[1]; pid = lxc_clone(r...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,797
static bool verify_start_hooks(struct lxc_conf *conf) { struct lxc_list *it; char path[MAXPATHLEN]; lxc_list_for_each(it, &conf->hooks[LXCHOOK_START]) { char *hookname = it->elem; struct stat st; int ret; ret = snprintf(path, MAXPATHLEN, "%s%s", conf->rootfs.path ? conf->rootfs.mount : "", hookname); i...
null
0
static bool verify_start_hooks(struct lxc_conf *conf) { struct lxc_list *it; char path[MAXPATHLEN]; lxc_list_for_each(it, &conf->hooks[LXCHOOK_START]) { char *hookname = it->elem; struct stat st; int ret; ret = snprintf(path, MAXPATHLEN, "%s%s", conf->rootfs.path ? conf->rootfs.mount : "", hookname); i...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,798
static int write_id_mapping(enum idtype idtype, pid_t pid, const char *buf, size_t buf_size) { char path[PATH_MAX]; int ret, closeret; FILE *f; ret = snprintf(path, PATH_MAX, "/proc/%d/%cid_map", pid, idtype == ID_TYPE_UID ? 'u' : 'g'); if (ret < 0 || ret >= PATH_MAX) { fprintf(stderr, "%s: path name too...
null
0
static int write_id_mapping(enum idtype idtype, pid_t pid, const char *buf, size_t buf_size) { char path[PATH_MAX]; int ret, closeret; FILE *f; ret = snprintf(path, PATH_MAX, "/proc/%d/%cid_map", pid, idtype == ID_TYPE_UID ? 'u' : 'g'); if (ret < 0 || ret >= PATH_MAX) { fprintf(stderr, "%s: path name too...
@@ -769,10 +769,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha * 2.6.32... */ { LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED, "proc", "%r/proc", "proc", MS_NODEV|MS_NOEXEC|MS_NOSUID, NULL }, - { LXC_AU...
CWE-59
null
null
35,799
static int _recursive_rmdir(char *dirname, dev_t pdev, const char *exclude, int level, bool onedev) { struct dirent dirent, *direntp; DIR *dir; int ret, failed=0; char pathname[MAXPATHLEN]; bool hadexclude = false; dir = opendir(dirname); if (!dir) { ERROR("%s: failed to open %s", __func__, dirname); ...
null
0
static int _recursive_rmdir(char *dirname, dev_t pdev, const char *exclude, int level, bool onedev) { struct dirent dirent, *direntp; DIR *dir; int ret, failed=0; char pathname[MAXPATHLEN]; bool hadexclude = false; dir = opendir(dirname); if (!dir) { ERROR("%s: failed to open %s", __func__, dirname); ...
@@ -1404,6 +1404,239 @@ int setproctitle(char *title) return ret; } +/* + * @path: a pathname where / replaced with '\0'. + * @offsetp: pointer to int showing which path segment was last seen. + * Updated on return to reflect the next segment. + * @fulllen: full original path length. + * Returns a poi...
CWE-59
null
null