diff options
author | Xi Wang <xi.wang@gmail.com> | 2011-11-29 13:26:30 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-30 00:51:03 +0400 |
commit | c89304b8ea34ab48ba6ae10e06a8b1b8c8212307 (patch) | |
tree | ef464824214e0e82b488664df25d1e9ebb9128b7 /net/sctp/sm_statefuns.c | |
parent | c1baa88431fe0fe4fad492dece4177a7735f89cf (diff) | |
download | linux-c89304b8ea34ab48ba6ae10e06a8b1b8c8212307.tar.xz |
sctp: better integer overflow check in sctp_auth_create_key()
The check from commit 30c2235c is incomplete and cannot prevent
cases like key_len = 0x80000000 (INT_MAX + 1). In that case, the
left-hand side of the check (INT_MAX - key_len), which is unsigned,
becomes 0xffffffff (UINT_MAX) and bypasses the check.
However this shouldn't be a security issue. The function is called
from the following two code paths:
1) setsockopt()
2) sctp_auth_asoc_set_secret()
In case (1), sca_keylength is never going to exceed 65535 since it's
bounded by a u16 from the user API. As such, the key length will
never overflow.
In case (2), sca_keylength is computed based on the user key (1 short)
and 2 * key_vector (3 shorts) for a total of 7 * USHRT_MAX, which still
will not overflow.
In other words, this overflow check is not really necessary. Just
make it more correct.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/sm_statefuns.c')
0 files changed, 0 insertions, 0 deletions