diff options
author | John Johansen <john.johansen@canonical.com> | 2016-06-02 02:37:02 -0700 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2017-01-27 11:16:13 +0100 |
commit | 1e612988489ab3ec2d2949161ebe498d29bf9940 (patch) | |
tree | 264085dd6de5c9c897b57f05dc6e4645a02d8fd7 | |
parent | 7a203ea257e9e3b701344a4bc42fceddff32f915 (diff) | |
download | linux-stable-1e612988489ab3ec2d2949161ebe498d29bf9940.tar.gz linux-stable-1e612988489ab3ec2d2949161ebe498d29bf9940.tar.bz2 linux-stable-1e612988489ab3ec2d2949161ebe498d29bf9940.zip |
apparmor: add missing id bounds check on dfa verification
commit 15756178c6a65b261a080e21af4766f59cafc112 upstream.
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r-- | security/apparmor/include/match.h | 1 | ||||
-rw-r--r-- | security/apparmor/match.c | 2 |
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 { #define YYTD_ID_ACCEPT2 6 #define YYTD_ID_NXT 7 #define YYTD_ID_TSIZE 8 +#define YYTD_ID_MAX 8 #define YYTD_DATA8 1 #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) * it every time we use td_id as an index */ th.td_id = be16_to_cpu(*(u16 *) (blob)) - 1; + if (th.td_id > YYTD_ID_MAX) + goto out; th.td_flags = be16_to_cpu(*(u16 *) (blob + 2)); th.td_lolen = be32_to_cpu(*(u32 *) (blob + 8)); blob += sizeof(struct table_header); |