Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <xiujianfeng@huawei.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>

authored by

Xiu Jianfeng and committed by
Paul Moore
15ec76fb 73de1bef

+2
+2
security/selinux/ss/policydb.h
··· 370 370 { 371 371 size_t len = bytes * num; 372 372 373 + if (len > fp->len) 374 + return -EINVAL; 373 375 memcpy(fp->data, buf, len); 374 376 fp->data += len; 375 377 fp->len -= len;