]> bbs.cooldavid.org Git - net-next-2.6.git/commit
AppArmor: Fix splitting an fqname into separate namespace and profile names
authorJohn Johansen <john.johansen@canonical.com>
Sat, 28 Aug 2010 01:33:28 +0000 (18:33 -0700)
committerJames Morris <jmorris@namei.org>
Tue, 7 Sep 2010 23:19:31 +0000 (09:19 +1000)
commit04ccd53f09741c4bc54ab36db000bc1383e4812e
treed8c6e27094cb3b042e852f01c09a3d21979150d2
parent3a2dc8382a3e85a51ed9c6f57ea80665ea7a0c95
AppArmor: Fix splitting an fqname into separate namespace and profile names

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>
Signed-off-by: James Morris <jmorris@namei.org>
security/apparmor/lib.c