mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
selinux: Add boundary check in put_entry()
[ Upstream commit 15ec76fb29 ]
Just like next_entry(), boundary check is necessary to prevent memory
out-of-bound access.
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
003a456ae6
commit
adbfdaacde
|
|
@ -370,6 +370,8 @@ static inline int put_entry(const void *buf, size_t bytes, int num, struct polic
|
||||||
{
|
{
|
||||||
size_t len = bytes * num;
|
size_t len = bytes * num;
|
||||||
|
|
||||||
|
if (len > fp->len)
|
||||||
|
return -EINVAL;
|
||||||
memcpy(fp->data, buf, len);
|
memcpy(fp->data, buf, len);
|
||||||
fp->data += len;
|
fp->data += len;
|
||||||
fp->len -= len;
|
fp->len -= len;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user