mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
![]() |
From 2be4aed1f3332d87273eb593944332054f3cffac Mon Sep 17 00:00:00 2001
|
||
|
From: John Johansen <john.johansen@canonical.com>
|
||
|
Date: Thu, 2 Jun 2016 02:37:02 -0700
|
||
|
Subject: [PATCH 17/25] apparmor: add missing id bounds check on dfa
|
||
|
verification
|
||
|
|
||
|
Signed-off-by: John Johansen <john.johansen@canonical.com>
|
||
|
---
|
||
|
security/apparmor/include/match.h | 1 +
|
||
|
security/apparmor/match.c | 2 ++
|
||
|
2 files changed, 3 insertions(+)
|
||
|
|
||
|
diff --git a/security/apparmor/include/match.h b/security/apparmor/include/match.h
|
||
|
index 001c43a..a1c04fe 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 727eb42..f9f57c6 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);
|
||
|
--
|
||
|
2.7.4
|
||
|
|