mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-11 04:37:29 +00:00
libsepol: do not dereference scope if it can be NULL
Doing this looks wrong: len = scope->decl_ids_len; if (scope == NULL) { /* ... */ Move the dereferencing of scope after the NULL check. This issue has been found using Infer static analyzer. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
da8e3c7d36
commit
0b136a35e3
@ -157,7 +157,7 @@ int is_id_enabled(char *id, policydb_t * p, int symbol_table)
|
||||
scope_datum_t *scope =
|
||||
(scope_datum_t *) hashtab_search(p->scope[symbol_table].table, id);
|
||||
avrule_decl_t *decl;
|
||||
uint32_t len = scope->decl_ids_len;
|
||||
uint32_t len;
|
||||
|
||||
if (scope == NULL) {
|
||||
return 0;
|
||||
@ -166,6 +166,7 @@ int is_id_enabled(char *id, policydb_t * p, int symbol_table)
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = scope->decl_ids_len;
|
||||
if (len < 1) {
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user