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");