Skip to content

Commit 15ec76f

Browse files
Xiu Jianfengpcmoore
authored andcommitted
selinux: Add boundary check in put_entry()
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]>
1 parent 73de1be commit 15ec76f

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)