[lxc-devel] [PATCH lxcfs 1/5] fix missing dereferencing in must_strcat_pid

Serge Hallyn serge.hallyn at ubuntu.com
Thu Jan 7 18:36:49 UTC 2016


Quoting Wolfgang Bumiller (w.bumiller at proxmox.com):
> Fixes a segfault when reading a /tasks file of a cgroup
> containing a large number of pids.
> 
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>

thanks

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  lxcfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lxcfs.c b/lxcfs.c
> index fe5ac3e..767a344 100644
> --- a/lxcfs.c
> +++ b/lxcfs.c
> @@ -85,7 +85,7 @@ static void must_strcat_pid(char **src, size_t *sz, size_t *asz, pid_t pid)
>  		} while (!d);
>  		*src = d;
>  		*asz = BUF_RESERVE_SIZE;
> -	} else if (strlen(tmp) + sz + 1 >= asz) {
> +	} else if (strlen(tmp) + *sz + 1 >= *asz) {
>  		do {
>  			d = realloc(d, *asz + BUF_RESERVE_SIZE);
>  		} while (!d);
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> 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