From 2ac9aafca6793e74587df7b81a1b27a71a16caa9 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Wed, 13 Mar 2013 21:19:24 -0500 Subject: [PATCH] commands.c: sanity check to not write too-long cgroup path name This can't really happen due to current limits in cgroup.c but add it in case those change in the future. Signed-off-by: Serge Hallyn --- src/lxc/commands.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lxc/commands.c b/src/lxc/commands.c index de9a7c45e..f18fe9e8a 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -91,6 +91,10 @@ static int receive_answer(int sock, struct lxc_answer *answer) ERROR("failed to receive answer for the command"); if (answer->pathlen == 0) return ret; + if (answer->pathlen >= MAXPATHLEN) { + ERROR("cgroup path was too long"); + return -1; + } ret = recv(sock, answerpath, answer->pathlen, 0); if (ret != answer->pathlen) { ERROR("failed to receive answer for the command"); -- 2.47.2