mirror of
https://github.com/topjohnwu/selinux.git
synced 2025-03-02 08:27:04 +00:00
libsepol: ensure key is valid before doing search
Signed-off-by: William Roberts <william.c.roberts@intel.com>
This commit is contained in:
parent
8b4ad4fde5
commit
b612314bf3
@ -262,6 +262,7 @@ int mls_context_isvalid(const policydb_t * p, const context_struct_t * c)
|
||||
user_datum_t *usrdatum;
|
||||
unsigned int i, l;
|
||||
ebitmap_node_t *cnode;
|
||||
hashtab_key_t key;
|
||||
|
||||
if (!p->mls)
|
||||
return 1;
|
||||
@ -279,11 +280,12 @@ int mls_context_isvalid(const policydb_t * p, const context_struct_t * c)
|
||||
if (!c->range.level[l].sens
|
||||
|| c->range.level[l].sens > p->p_levels.nprim)
|
||||
return 0;
|
||||
levdatum = (level_datum_t *) hashtab_search(p->p_levels.table,
|
||||
p->
|
||||
p_sens_val_to_name
|
||||
[c->range.level[l].
|
||||
sens - 1]);
|
||||
|
||||
key = p->p_sens_val_to_name[c->range.level[l].sens - 1];
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
levdatum = (level_datum_t *) hashtab_search(p->p_levels.table, key);
|
||||
if (!levdatum)
|
||||
return 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user