Message ID | 20241106-tcp-md5-diag-prep-v1-5-d62debf3dded@gmail.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Make TCP-MD5-diag slightly less broken | expand |
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c index 722dbfd54d247b4def1e77b1674c5b207c5a939d..d55a0ac39fa0853806efd4a6b38591255e0f4930 100644 --- a/net/ipv4/tcp_diag.c +++ b/net/ipv4/tcp_diag.c @@ -72,6 +72,7 @@ static int tcp_diag_put_md5sig(struct sk_buff *skb, return 0; attrlen = skb_availroom(skb) - NLA_HDRLEN; + attrlen = min(attrlen, U16_MAX - 1); /* attr->nla_len */ md5sig_count = min(md5sig_count, attrlen / key_size); attr = nla_reserve(skb, INET_DIAG_MD5SIG, md5sig_count * key_size); if (!attr)