aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2009-09-30 13:51:11 +0200
committerWilly Tarreau <w@1wt.eu>2009-11-07 17:03:36 +0100
commit97cba8c1ff818c76b5149a87f5de35d94acf46ce (patch)
tree889a02bc28ef9398d4196ca440769c5289609262
parent8ef3a2f6cfcc081debe804323fff7a206aa8f9d0 (diff)
downloadlinux-2.4-97cba8c1ff818c76b5149a87f5de35d94acf46ce.tar.gz
net ax25: Fix signed comparison in the sockopt handler
fixed upstream in commit b7058842c940ad2c08dd829b21e5c92ebe3b8758 in a different way The ax25 code tried to use if (optlen < sizeof(int)) return -EINVAL; as a security check against optlen being negative (or zero) in the set socket option. Unfortunately, "sizeof(int)" is an unsigned property, with the result that the whole comparison is done in unsigned, letting negative values slip through. This patch changes this to if (optlen < (int)sizeof(int)) return -EINVAL; so that the comparison is done as signed, and negative values get properly caught. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: David S. Miller <davem@davemloft.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--net/ax25/af_ax25.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 1304a343b49a73..689bdbf7cdbaaa 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -639,7 +639,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, char *op
if (level != SOL_AX25)
return -ENOPROTOOPT;
- if (optlen < sizeof(int))
+ if (optlen < (int)sizeof(int))
return -EINVAL;
if (get_user(opt, (int *)optval))