[lxc-devel] [PATCH] Check return value of snprintf in mount_proc_if_needed()
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Sep 28 03:51:41 UTC 2015
Quoting Christian Brauner (christianvanbrauner at gmail.com):
> Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/utils.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index 0b83960..8e7fc52 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -1431,6 +1431,10 @@ int mount_proc_if_needed(const char *rootfs)
> mypid = (int)getpid();
> INFO("I am %d, /proc/self points to '%s'", mypid, link);
> ret = snprintf(path, MAXPATHLEN, "%s/proc", rootfs);
> + if (ret < 0 || ret >= MAXPATHLEN) {
> + SYSERROR("proc path name too long");
> + return -1;
> + }
> if (linklen < 0) /* /proc not mounted */
> goto domount;
> if (atoi(link) != mypid) {
> --
> 2.5.3
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list