summaryrefslogtreecommitdiffstats
path: root/net/sctp/auth.c
diff options
context:
space:
mode:
authorDavid S. Miller2008-08-30 08:06:00 +0200
committerDavid S. Miller2008-08-30 08:06:00 +0200
commitb171e19ed08c8ba832e5325fadf1be493f56665d (patch)
tree017208f9fcc4ef2cc3fe5cc3f262d2455eda9f61 /net/sctp/auth.c
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linvil... (diff)
parentnet: Unbreak userspace usage of linux/mroute.h (diff)
downloadkernel-qcow2-linux-b171e19ed08c8ba832e5325fadf1be493f56665d.tar.gz
kernel-qcow2-linux-b171e19ed08c8ba832e5325fadf1be493f56665d.tar.xz
kernel-qcow2-linux-b171e19ed08c8ba832e5325fadf1be493f56665d.zip
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: net/mac80211/mlme.c
Diffstat (limited to 'net/sctp/auth.c')
-rw-r--r--net/sctp/auth.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 675a5c3e68a6..52db5f60daa0 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -80,6 +80,10 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp)
{
struct sctp_auth_bytes *key;
+ /* Verify that we are not going to overflow INT_MAX */
+ if ((INT_MAX - key_len) < sizeof(struct sctp_auth_bytes))
+ return NULL;
+
/* Allocate the shared key */
key = kmalloc(sizeof(struct sctp_auth_bytes) + key_len, gfp);
if (!key)
@@ -782,6 +786,9 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep,
for (i = 0; i < hmacs->shmac_num_idents; i++) {
id = hmacs->shmac_idents[i];
+ if (id > SCTP_AUTH_HMAC_ID_MAX)
+ return -EOPNOTSUPP;
+
if (SCTP_AUTH_HMAC_ID_SHA1 == id)
has_sha1 = 1;