From f232f9013f04234f0c9a457499ccc9ee2254d7b3 Mon Sep 17 00:00:00 2001 From: Ji Qin Date: Sun, 14 Jun 2020 21:20:23 -0400 Subject: [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle Content-type: text/plain error occur when selinux_restorecon_default_handle return NULL in restorecon_init. fixes: https://github.com/SELinuxProject/selinux/issues/249 Signed-off-by: Ji Qin Acked-by: Stephen Smalley --- libselinux/src/selinux_restorecon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c index b37027640926..a57932c0602b 100644 --- a/libselinux/src/selinux_restorecon.c +++ b/libselinux/src/selinux_restorecon.c @@ -1062,6 +1062,8 @@ void selinux_restorecon_set_sehandle(struct selabel_handle *hndl) size_t num_specfiles; fc_sehandle = (struct selabel_handle *) hndl; + if (!fc_sehandle) + return; /* * Read digest if requested in selabel_open(3) and set global params. -- 2.48.1