Skip to content

Commit

Permalink
libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle
Browse files Browse the repository at this point in the history
error occur when selinux_restorecon_default_handle return NULL in
restorecon_init.

fixes: SELinuxProject/selinux#249

Signed-off-by: Ji Qin <jiqin.ji@huawei.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
  • Loading branch information
yanjinjq authored and bachradsusi committed Jun 18, 2020
1 parent 4613038 commit 08f5e30
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libselinux/src/selinux_restorecon.c
Expand Up @@ -1154,6 +1154,8 @@ void selinux_restorecon_set_sehandle(struct selabel_handle *hndl)
size_t num_specfiles, fc_digest_len;

fc_sehandle = (struct selabel_handle *) hndl;
if (!fc_sehandle)
return;

/* Check if digest requested in selabel_open(3), if so use it. */
if (selabel_digest(fc_sehandle, &fc_digest, &fc_digest_len,
Expand Down

0 comments on commit 08f5e30

Please sign in to comment.