Avoid risk of "too far memory read"

As we call "lxc_add_state_client(fd, handler, (lxc_state_t *)req->data)"
which supposes that the last parameter is a table of MAX_STATE
entries when calling memcpy():
memcpy(newclient->states, states, sizeof(newclient->states))

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
This commit is contained in:
Rachid Koucha 2019-01-27 00:10:39 +01:00 committed by GitHub
parent 81f22990c7
commit 71fc9c0468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -896,7 +896,7 @@ static int lxc_cmd_add_state_client_callback(int fd, struct lxc_cmd_req *req,
if (req->datalen < 0)
goto reap_client_fd;
if (req->datalen > (sizeof(lxc_state_t) * MAX_STATE))
if (req->datalen != (sizeof(lxc_state_t) * MAX_STATE))
goto reap_client_fd;
if (!req->data)