Commit 1e612988 authored by John Johansen's avatar John Johansen Committed by Jiri Slaby

apparmor: add missing id bounds check on dfa verification

commit 15756178 upstream.
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 7a203ea2
...@@ -62,6 +62,7 @@ struct table_set_header { ...@@ -62,6 +62,7 @@ struct table_set_header {
#define YYTD_ID_ACCEPT2 6 #define YYTD_ID_ACCEPT2 6
#define YYTD_ID_NXT 7 #define YYTD_ID_NXT 7
#define YYTD_ID_TSIZE 8 #define YYTD_ID_TSIZE 8
#define YYTD_ID_MAX 8
#define YYTD_DATA8 1 #define YYTD_DATA8 1
#define YYTD_DATA16 2 #define YYTD_DATA16 2
......
...@@ -47,6 +47,8 @@ static struct table_header *unpack_table(char *blob, size_t bsize) ...@@ -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 * it every time we use td_id as an index
*/ */
th.td_id = be16_to_cpu(*(u16 *) (blob)) - 1; 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_flags = be16_to_cpu(*(u16 *) (blob + 2));
th.td_lolen = be32_to_cpu(*(u32 *) (blob + 8)); th.td_lolen = be32_to_cpu(*(u32 *) (blob + 8));
blob += sizeof(struct table_header); blob += sizeof(struct table_header);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment