diff options
-rw-r--r-- | net/sctp/auth.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 56935bbc1496..914c41978f52 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -542,16 +542,20 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc) id = ntohs(hmacs->hmac_ids[i]); /* Check the id is in the supported range */ - if (id > SCTP_AUTH_HMAC_ID_MAX) + if (id > SCTP_AUTH_HMAC_ID_MAX) { + id = 0; continue; + } /* See is we support the id. Supported IDs have name and * length fields set, so that we can allocated and use * them. We can safely just check for name, for without the * name, we can't allocate the TFM. */ - if (!sctp_hmac_list[id].hmac_name) + if (!sctp_hmac_list[id].hmac_name) { + id = 0; continue; + } break; } |