From: John Johansen <john.johansen@canonical.com>
To: linux-kernel@vger.kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: [PATCH 3/4] AppArmor: Fix splitting an fqname into separate namespace and profile names
Date: Fri, 27 Aug 2010 18:33:28 -0700 [thread overview]
Message-ID: <1282959209-5431-4-git-send-email-john.johansen@canonical.com> (raw)
In-Reply-To: <1282959209-5431-1-git-send-email-john.johansen@canonical.com>
As per Dan Carpenter <error27@gmail.com>
If we have a ns name without a following profile then in the original
code it did "*ns_name = &name[1];". "name" is NULL so "*ns_name" is
0x1. That isn't useful and could cause an oops when this function is
called from aa_remove_profiles().
Beyond this the assignment of the namespace name was wrong in the case
where the profile name was provided as it was being set to &name[1]
after name = skip_spaces(split + 1);
Move the ns_name assignment before updating name for the split and
also add skip_spaces, making the interface more robust.
Signed-off-by: John Johansen <john.johansen@canonical.com>
---
security/apparmor/lib.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c
index 6e85cdb..506d2ba 100644
--- a/security/apparmor/lib.c
+++ b/security/apparmor/lib.c
@@ -40,6 +40,7 @@ char *aa_split_fqname(char *fqname, char **ns_name)
*ns_name = NULL;
if (name[0] == ':') {
char *split = strchr(&name[1], ':');
+ *ns_name = skip_spaces(&name[1]);
if (split) {
/* overwrite ':' with \0 */
*split = 0;
@@ -47,7 +48,6 @@ char *aa_split_fqname(char *fqname, char **ns_name)
} else
/* a ns name without a following profile is allowed */
name = NULL;
- *ns_name = &name[1];
}
if (name && *name == 0)
name = NULL;
--
1.7.0.4
next prev parent reply other threads:[~2010-08-28 1:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-28 1:33 [Patch 0/4] AppArmor post 2.6.36 merge fixups John Johansen
2010-08-28 1:33 ` [PATCH 1/4] AppArmor: Drop hack to remove appended " (deleted)" string John Johansen
2010-08-28 1:33 ` [PATCH 2/4] AppArmor: Fix security_task_setrlimit logic for 2.6.36 changes John Johansen
2010-08-28 17:10 ` John Johansen
2010-08-28 18:15 ` Jiri Slaby
2010-08-28 20:35 ` John Johansen
2010-08-28 20:48 ` Jiri Slaby
2010-08-30 16:53 ` John Johansen
2010-08-30 21:33 ` Jiri Slaby
2010-09-06 17:10 ` John Johansen
2010-08-28 1:33 ` John Johansen [this message]
2010-08-28 1:33 ` [PATCH 4/4] AppArmor: Fix locking from removal of profile namespace John Johansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282959209-5431-4-git-send-email-john.johansen@canonical.com \
--to=john.johansen@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®