selinux: conditional expression type validation was off-by-one
authorVesa-Matti Kari <vmkari@cc.helsinki.fi>
Wed, 6 Aug 2008 15:24:51 +0000 (18:24 +0300)
committerJames Morris <jmorris@namei.org>
Wed, 6 Aug 2008 22:56:16 +0000 (08:56 +1000)
expr_isvalid() in conditional.c was off-by-one and allowed
invalid expression type COND_LAST. However, it is this header file
that needs to be fixed. That way the if-statement's disjunction's
second component reads more naturally, "if expr type is greater than
the last allowed value" ( rather than using ">=" in conditional.c):

  if (expr->expr_type <= 0 || expr->expr_type > COND_LAST)

Signed-off-by: Vesa-Matti Kari <vmkari@cc.helsinki.fi>
Signed-off-by: James Morris <jmorris@namei.org>
security/selinux/ss/conditional.h

index 65b9f8366e9c8635020c934e66f12a4901bbc1d8..53ddb013ae573f8bb053da9fa9416fbcf5ee9701 100644 (file)
@@ -28,7 +28,7 @@ struct cond_expr {
 #define COND_XOR       5 /* bool ^ bool */
 #define COND_EQ                6 /* bool == bool */
 #define COND_NEQ       7 /* bool != bool */
-#define COND_LAST      8
+#define COND_LAST      COND_NEQ
        __u32 expr_type;
        __u32 bool;
        struct cond_expr *next;