smackfs: do not trust `count' in inodes write()s

Smackfs write() implementation does not put a higher bound on the number of
bytes to copy from user-space.  This may lead to a DOS attack if a malicious
`count' field is given.

Assure that given `count' is exactly the length needed for a /smack/load rule.
 In case of /smack/cipso where the length is relative, assure that `count'
does not exceed the size needed for a buffer representing maximum possible
number of CIPSO 2.2 categories.

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Ahmed S. Darwish
2008-03-13 12:32:34 -07:00
committed by Linus Torvalds
parent 93d74463d0
commit b500ce8d24
2 changed files with 20 additions and 19 deletions

View File

@@ -26,14 +26,6 @@
#define SMK_MAXLEN 23
#define SMK_LABELLEN (SMK_MAXLEN+1)
/*
* How many kinds of access are there?
* Here's your answer.
*/
#define SMK_ACCESSDASH '-'
#define SMK_ACCESSLOW "rwxa"
#define SMK_ACCESSKINDS (sizeof(SMK_ACCESSLOW) - 1)
struct superblock_smack {
char *smk_root;
char *smk_floor;