2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-01 23:05:11 +00:00

fix the depth check for hat expansion

This commit is contained in:
John Johansen
2007-04-14 05:24:10 +00:00
parent 4e2bf5ab74
commit 9182e53486

View File

@@ -1,8 +1,8 @@
--- ---
security/apparmor/match.c | 12 ++++++------ security/apparmor/match.c | 12 ++++++------
security/apparmor/match.h | 2 +- security/apparmor/match.h | 2 +-
security/apparmor/module_interface.c | 13 +++++++------ security/apparmor/module_interface.c | 10 ++++++----
3 files changed, 14 insertions(+), 13 deletions(-) 3 files changed, 13 insertions(+), 11 deletions(-)
--- a/security/apparmor/match.c --- a/security/apparmor/match.c
+++ b/security/apparmor/match.c +++ b/security/apparmor/match.c
@@ -67,12 +67,12 @@
{ {
struct aa_profile *profile = NULL; struct aa_profile *profile = NULL;
@@ -283,10 +283,10 @@ static struct aa_profile *aa_unpack_prof @@ -284,9 +284,11 @@ static struct aa_profile *aa_unpack_prof
}
/* get optional subprofiles */ /* get optional subprofiles */
- if (aa_is_nameX(e, AA_LIST, "hats")) { if (aa_is_nameX(e, AA_LIST, "hats")) {
+ if (aa_is_nameX(e, AA_LIST, "hats") && depth == 0) { + if (depth > 0)
+ goto fail;
while (!aa_is_nameX(e, AA_LISTEND, NULL)) { while (!aa_is_nameX(e, AA_LISTEND, NULL)) {
struct aa_profile *subprofile; struct aa_profile *subprofile;
- subprofile = aa_unpack_profile(e); - subprofile = aa_unpack_profile(e);
@@ -80,17 +80,7 @@
if (IS_ERR(subprofile)) { if (IS_ERR(subprofile)) {
error = PTR_ERR(subprofile); error = PTR_ERR(subprofile);
goto fail; goto fail;
@@ -294,7 +294,8 @@ static struct aa_profile *aa_unpack_prof @@ -320,7 +322,7 @@ fail:
subprofile->parent = profile;
list_add(&subprofile->list, &profile->sub);
}
- }
+ } else if (depth > 0)
+ goto fail;
if (!aa_is_nameX(e, AA_STRUCTEND, NULL))
goto fail;
@@ -320,7 +321,7 @@ fail:
*/ */
static struct aa_profile *aa_unpack_profile_wrapper(struct aa_ext *e) static struct aa_profile *aa_unpack_profile_wrapper(struct aa_ext *e)
{ {