aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2016-06-02 05:37:02 -0400
committerJohn Johansen <john.johansen@canonical.com>2016-07-12 11:43:10 -0400
commit15756178c6a65b261a080e21af4766f59cafc112 (patch)
tree98fabd29ae0f62c2f3b99ae0e57ba5d253e4bf82
parentff118479a76dbece9ae1c65c7c6a3ebe9cfa73e0 (diff)
apparmor: add missing id bounds check on dfa verification
Signed-off-by: John Johansen <john.johansen@canonical.com>
-rw-r--r--security/apparmor/include/match.h1
-rw-r--r--security/apparmor/match.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/security/apparmor/include/match.h b/security/apparmor/include/match.h
index 001c43aa0406..a1c04fe86790 100644
--- a/security/apparmor/include/match.h
+++ b/security/apparmor/include/match.h
@@ -62,6 +62,7 @@ struct table_set_header {
62#define YYTD_ID_ACCEPT2 6 62#define YYTD_ID_ACCEPT2 6
63#define YYTD_ID_NXT 7 63#define YYTD_ID_NXT 7
64#define YYTD_ID_TSIZE 8 64#define YYTD_ID_TSIZE 8
65#define YYTD_ID_MAX 8
65 66
66#define YYTD_DATA8 1 67#define YYTD_DATA8 1
67#define YYTD_DATA16 2 68#define YYTD_DATA16 2
diff --git a/security/apparmor/match.c b/security/apparmor/match.c
index 727eb4200d5c..f9f57c626f54 100644
--- a/security/apparmor/match.c
+++ b/security/apparmor/match.c
@@ -47,6 +47,8 @@ static struct table_header *unpack_table(char *blob, size_t bsize)
47 * it every time we use td_id as an index 47 * it every time we use td_id as an index
48 */ 48 */
49 th.td_id = be16_to_cpu(*(u16 *) (blob)) - 1; 49 th.td_id = be16_to_cpu(*(u16 *) (blob)) - 1;
50 if (th.td_id > YYTD_ID_MAX)
51 goto out;
50 th.td_flags = be16_to_cpu(*(u16 *) (blob + 2)); 52 th.td_flags = be16_to_cpu(*(u16 *) (blob + 2));
51 th.td_lolen = be32_to_cpu(*(u32 *) (blob + 8)); 53 th.td_lolen = be32_to_cpu(*(u32 *) (blob + 8));
52 blob += sizeof(struct table_header); 54 blob += sizeof(struct table_header);