Skip to content

Commit 7f5249a

Browse files
committed
selinux: Add boundary check in put_entry()
jira VULN-70689 cve CVE-2022-50200 commit-author Xiu Jianfeng <[email protected]> commit 15ec76f Just like next_entry(), boundary check is necessary to prevent memory out-of-bound access. Signed-off-by: Xiu Jianfeng <[email protected]> Signed-off-by: Paul Moore <[email protected]> (cherry picked from commit 15ec76f) Signed-off-by: Brett Mastbergen <[email protected]>
1 parent 1d3425d commit 7f5249a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

security/selinux/ss/policydb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ static inline int put_entry(const void *buf, size_t bytes, int num, struct polic
370370
{
371371
size_t len = bytes * num;
372372

373+
if (len > fp->len)
374+
return -EINVAL;
373375
memcpy(fp->data, buf, len);
374376
fp->data += len;
375377
fp->len -= len;

0 commit comments

Comments
 (0)