SELinux Security Module development
 help / color / mirror / Atom feed
* [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle
@ 2020-06-15  1:20 Ji Qin
  2020-06-15 11:39 ` Stephen Smalley
  0 siblings, 1 reply; 3+ messages in thread
From: Ji Qin @ 2020-06-15  1:20 UTC (permalink / raw)
  To: selinux; +Cc: jiqin.ji

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 <jiqin.ji@huawei.com>
---
 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 91dfeb66..c2d05a66 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -1153,6 +1153,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,
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-18 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-15  1:20 [PATCH] libselinux: Fix NULL pointer use in selinux_restorecon_set_sehandle Ji Qin
2020-06-15 11:39 ` Stephen Smalley
2020-06-18 19:33   ` Petr Lautrbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox