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

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Jan 7 11:59:51 UTC 2016


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>
---
 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




More information about the lxc-devel mailing list