libselinux: stringrep / mapping fix
PATCH 1/1 libselinux: stringrep / mapping fix
On one of the paths through security_class_to_string, the unmapping is done twice. Same with security_av_perm_to_string.
Signed-off-by Eamon Walsh <[email protected]>
---
stringrep.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
src/stringrep.c +0 -0
@@ -370,8 +370,6 @@
static const char *security_class_to_string_compat(security_class_t tclass) {
- tclass = unmap_class(tclass);
-
if (tclass > 0 && tclass < NCLASSES) return class_to_string_data.str + class_to_string[tclass];
@@ -386,9 +384,6 @@
access_vector_t common_base = 0; unsigned int i;
- av = unmap_perm(tclass, av);
- tclass = unmap_class(tclass);
-
if (!av) return NULL;
@@ -466,10 +461,11 @@
{
struct discover_class_node *node;+ tclass = unmap_class(tclass);
+
if (obj_class_compat) return security_class_to_string_compat(tclass);
- tclass = unmap_class(tclass); node = get_class_cache_entry_value(tclass); if (node == NULL) return security_class_to_string_compat(tclass); @@ -483,11 +479,12 @@ struct discover_class_node *node; size_t i;
+ av = unmap_perm(tclass, av);
+ tclass = unmap_class(tclass);
+
if (obj_class_compat) return security_av_perm_to_string_compat(tclass,av);
- av = unmap_perm(tclass, av);
- tclass = unmap_class(tclass); node = get_class_cache_entry_value(tclass); if (av && node) for (i = 0; i<MAXVECTORS; i++)
Signature · 8 lines
Eamon Walsh <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.