[XFRM]: Prevent off-by-one access to xfrm_dispatch
authorThomas Graf <tgraf@suug.ch>
Tue, 3 May 2005 21:26:01 +0000 (14:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 May 2005 21:26:01 +0000 (14:26 -0700)
Makes the type > XFRM_MSG_MAX check behave correctly to
protect access to xfrm_dispatch.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/xfrm.h

index f0df02ae68a4138152b5f278f9a1afaaf973554a..4d19b9e65317cb622ca5f56058c1fa3ae0c72b98 100644 (file)
@@ -140,8 +140,9 @@ enum {
        XFRM_MSG_FLUSHPOLICY,
 #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY
 
-       XFRM_MSG_MAX
+       __XFRM_MSG_MAX
 };
+#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
 
 struct xfrm_user_tmpl {
        struct xfrm_id          id;