Commit 2ac9aafc by Serge Hallyn

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: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 4f7521b4
...@@ -91,6 +91,10 @@ static int receive_answer(int sock, struct lxc_answer *answer) ...@@ -91,6 +91,10 @@ static int receive_answer(int sock, struct lxc_answer *answer)
ERROR("failed to receive answer for the command"); ERROR("failed to receive answer for the command");
if (answer->pathlen == 0) if (answer->pathlen == 0)
return ret; return ret;
if (answer->pathlen >= MAXPATHLEN) {
ERROR("cgroup path was too long");
return -1;
}
ret = recv(sock, answerpath, answer->pathlen, 0); ret = recv(sock, answerpath, answer->pathlen, 0);
if (ret != answer->pathlen) { if (ret != answer->pathlen) {
ERROR("failed to receive answer for the command"); ERROR("failed to receive answer for the command");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment