projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c877c52
)
selinux: Add boundary check in put_entry()
author
Xiu Jianfeng
<xiujianfeng@huawei.com>
Tue, 14 Jun 2022 02:14:49 +0000
(10:14 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:05 +0000
(14:23 +0200)
[ Upstream commit
15ec76fb29be31df2bccb30fc09875274cba2776
]
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>
security/selinux/ss/policydb.h
patch
|
blob
|
history
diff --git
a/security/selinux/ss/policydb.h
b/security/selinux/ss/policydb.h
index c24d4e1063ea006bd809b16b83e0e718b9e56c66..ffc4e7bad20542ef9453e422c4f54b4b49e8d5db 100644
(file)
--- a/
security/selinux/ss/policydb.h
+++ b/
security/selinux/ss/policydb.h
@@
-370,6
+370,8
@@
static inline int put_entry(const void *buf, size_t bytes, int num, struct polic
{
size_t len = bytes * num;
+ if (len > fp->len)
+ return -EINVAL;
memcpy(fp->data, buf, len);
fp->data += len;
fp->len -= len;