mirror of
git://github.com/lxc/lxc
synced 2025-09-01 09:33:49 +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:
@@ -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");
|
||||||
|
Reference in New Issue
Block a user