]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - security/apparmor/lib.c
apparmor: Fix uninitialized value in aa_split_fqname
[mirror_ubuntu-bionic-kernel.git] / security / apparmor / lib.c
index 4d5e98e49d5e06a9066f618adabe2767da45ff3c..0287132624d9384542a079111efe67ee3f70426c 100644 (file)
@@ -90,10 +90,12 @@ const char *aa_splitn_fqname(const char *fqname, size_t n, const char **ns_name,
        const char *end = fqname + n;
        const char *name = skipn_spaces(fqname, n);
 
-       if (!name)
-               return NULL;
        *ns_name = NULL;
        *ns_len = 0;
+
+       if (!name)
+               return NULL;
+
        if (name[0] == ':') {
                char *split = strnchr(&name[1], end - &name[1], ':');
                *ns_name = skipn_spaces(&name[1], end - &name[1]);
@@ -211,7 +213,8 @@ void aa_perm_mask_to_str(char *str, const char *chrs, u32 mask)
        *str = '\0';
 }
 
-void aa_audit_perm_names(struct audit_buffer *ab, const char **names, u32 mask)
+void aa_audit_perm_names(struct audit_buffer *ab, const char * const *names,
+                        u32 mask)
 {
        const char *fmt = "%s";
        unsigned int i, perm = 1;
@@ -229,7 +232,7 @@ void aa_audit_perm_names(struct audit_buffer *ab, const char **names, u32 mask)
 }
 
 void aa_audit_perm_mask(struct audit_buffer *ab, u32 mask, const char *chrs,
-                       u32 chrsmask, const char **names, u32 namesmask)
+                       u32 chrsmask, const char * const *names, u32 namesmask)
 {
        char str[33];
 
@@ -326,7 +329,7 @@ void aa_compute_perms(struct aa_dfa *dfa, unsigned int state,
        /* for v5 perm mapping in the policydb, the other set is used
         * to extend the general perm set
         */
-       perms->allow |= map_other(dfa_other_allow(dfa, state));
+       perms->allow |= map_other(dfa_other_allow(dfa, state)) | AA_MAY_LOCK;
        perms->audit |= map_other(dfa_other_audit(dfa, state));
        perms->quiet |= map_other(dfa_other_quiet(dfa, state));
 //     perms->xindex = dfa_user_xindex(dfa, state);