Date: Wed, 1 Jul 2020 21:37:32 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362868 - stable/12/sys/netinet Message-ID: <202007012137.061LbWnY019709@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Wed Jul 1 21:37:32 2020 New Revision: 362868 URL: https://svnweb.freebsd.org/changeset/base/362868 Log: MFC r355931: Improve input validation for some parameters having a too small reported length. Thanks to Natalie Silvanovich from Google for finding one of these issues in the SCTP userland stack and reporting it. Modified: stable/12/sys/netinet/sctp_auth.c stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_auth.c ============================================================================== --- stable/12/sys/netinet/sctp_auth.c Wed Jul 1 21:27:33 2020 (r362867) +++ stable/12/sys/netinet/sctp_auth.c Wed Jul 1 21:37:32 2020 (r362868) @@ -1397,7 +1397,8 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str ptype = ntohs(phdr->param_type); plen = ntohs(phdr->param_length); - if ((plen == 0) || (offset + plen > length)) + if ((plen < sizeof(struct sctp_paramhdr)) || + (offset + plen > length)) break; if (ptype == SCTP_RANDOM) { Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Wed Jul 1 21:27:33 2020 (r362867) +++ stable/12/sys/netinet/sctp_pcb.c Wed Jul 1 21:37:32 2020 (r362868) @@ -6202,7 +6202,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s if (offset + plen > limit) { break; } - if (plen == 0) { + if (plen < sizeof(struct sctp_paramhdr)) { break; } #ifdef INET @@ -6427,6 +6427,9 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s } if (plen > sizeof(lstore)) { return (-23); + } + if (plen < sizeof(struct sctp_asconf_addrv4_param)) { + return (-101); } phdr = sctp_get_next_param(m, offset, (struct sctp_paramhdr *)&lstore,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007012137.061LbWnY019709>