selinux: check return value of string_to_security_class()
This should never happen, but better safe than sorry.
This commit is contained in:
parent
81d4a026a6
commit
fdb0405edd
|
@ -233,6 +233,9 @@ int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
sclass = string_to_security_class("process");
|
sclass = string_to_security_class("process");
|
||||||
|
if (sclass == 0)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
r = security_compute_create_raw(mycon, fcon, sclass, label);
|
r = security_compute_create_raw(mycon, fcon, sclass, label);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
@ -312,6 +315,9 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
sclass = string_to_security_class("process");
|
sclass = string_to_security_class("process");
|
||||||
|
if (sclass == 0)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
r = security_compute_create_raw(mycon, fcon, sclass, label);
|
r = security_compute_create_raw(mycon, fcon, sclass, label);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
Loading…
Reference in New Issue