selinux: check return value of string_to_security_class()

This should never happen, but better safe than sorry.
This commit is contained in:
Christian Göttsche 2020-03-02 17:53:20 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 81d4a026a6
commit fdb0405edd
1 changed files with 6 additions and 0 deletions

View File

@ -233,6 +233,9 @@ int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
return -errno;
sclass = string_to_security_class("process");
if (sclass == 0)
return -ENOSYS;
r = security_compute_create_raw(mycon, fcon, sclass, label);
if (r < 0)
return -errno;
@ -312,6 +315,9 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
return -ENOMEM;
sclass = string_to_security_class("process");
if (sclass == 0)
return -ENOSYS;
r = security_compute_create_raw(mycon, fcon, sclass, label);
if (r < 0)
return -errno;