mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
selinux: tighten type validation during policy load
Tighten type validation during policy load to improve robustness in the face of ill-formed policies. Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
parent
d3e4784c2b
commit
ef0740b4b7
|
|
@ -604,10 +604,15 @@ static int type_index(void *key, void *datum, void *datap)
|
|||
typdatum = datum;
|
||||
p = datap;
|
||||
|
||||
if (!typdatum->value || typdatum->value > p->p_types.nprim ||
|
||||
typdatum->bounds > p->p_types.nprim) {
|
||||
pr_err("SELinux: type %s had value %u bounds %u nprim %u\n",
|
||||
(char *)key, typdatum->value, typdatum->bounds,
|
||||
p->p_types.nprim);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (typdatum->primary) {
|
||||
if (!typdatum->value || typdatum->value > p->p_types.nprim ||
|
||||
typdatum->bounds > p->p_types.nprim)
|
||||
return -EINVAL;
|
||||
p->sym_val_to_name[SYM_TYPES][typdatum->value - 1] = key;
|
||||
p->type_val_to_struct[typdatum->value - 1] = typdatum;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user