diff --git a/libselinux/src/mapping.c b/libselinux/src/mapping.c index f9858ce1..b0264e77 100644 --- a/libselinux/src/mapping.c +++ b/libselinux/src/mapping.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include "mapping.h" @@ -103,8 +102,13 @@ unmap_class(security_class_t tclass) if (tclass < current_mapping_size) return current_mapping[tclass].value; - assert(current_mapping_size == 0); - return tclass; + /* If here no mapping set or the class requested is not valid. */ + if (current_mapping_size != 0) { + errno = EINVAL; + return 0; + } + else + return tclass; } access_vector_t @@ -116,16 +120,19 @@ unmap_perm(security_class_t tclass, access_vector_t tperm) for (i=0; i