|
@@ -80,6 +80,10 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp)
|
|
{
|
|
{
|
|
struct sctp_auth_bytes *key;
|
|
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 */
|
|
/* Allocate the shared key */
|
|
key = kmalloc(sizeof(struct sctp_auth_bytes) + key_len, gfp);
|
|
key = kmalloc(sizeof(struct sctp_auth_bytes) + key_len, gfp);
|
|
if (!key)
|
|
if (!key)
|