]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
fix missing dereferencing in must_strcat_pid
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 7 Jan 2016 11:59:51 +0000 (12:59 +0100)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 7 Jan 2016 19:13:27 +0000 (11:13 -0800)
Fixes a segfault when reading a /tasks file of a cgroup
containing a large number of pids.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
lxcfs.c

diff --git a/lxcfs.c b/lxcfs.c
index fe5ac3e551f16fec40b317699e55e22aa56d59f5..767a34404126214fc3c5f6b6b88ba2c9fce251d3 100644 (file)
--- 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);