2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 12:49:31 +00:00

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 <serge.hallyn@ubuntu.com>
This commit is contained in:
Serge Hallyn
2013-03-13 21:19:24 -05:00
parent 4f7521b413
commit 2ac9aafca6

View File

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