From: Christian Brauner Date: Sat, 29 Oct 2016 10:00:06 +0000 (+0200) Subject: utils: use lxc_safe_int() X-Git-Tag: lxc-2.1.0~257^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d036ccac09afa4ba3ff031384e5903ef8d662df;p=thirdparty%2Flxc.git utils: use lxc_safe_int() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 3b05842b6..e1191a3cf 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -1766,7 +1766,7 @@ int mount_proc_if_needed(const char *rootfs) { char path[MAXPATHLEN]; char link[20]; - int linklen, ret; + int link_to_pid, linklen, ret; int mypid; ret = snprintf(path, MAXPATHLEN, "%s/proc/self", rootfs); @@ -1785,7 +1785,9 @@ int mount_proc_if_needed(const char *rootfs) } if (linklen < 0) /* /proc not mounted */ goto domount; - if (atoi(link) != mypid) { + if (lxc_safe_int(link, &link_to_pid) < 0) + return -1; + if (link_to_pid != mypid) { /* wrong /procs mounted */ umount2(path, MNT_DETACH); /* ignore failure */ goto domount;