git: af08cafda0d1 - stable/13 - sctp: improve consistency

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Thu, 01 Aug 2024 20:21:19 UTC
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=af08cafda0d10a64bae8328126868c527171963b

commit af08cafda0d10a64bae8328126868c527171963b
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-02-23 20:40:46 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-08-01 20:20:46 +0000

    sctp: improve consistency
    
    (cherry picked from commit 533faf21c19d0fa4bc3c0a986c67667991f90883)
---
 sys/netinet/sctp_output.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 7626e4ec066c..f13010e54521 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -5019,11 +5019,16 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
 			at += padded_size;
 			break;
 		case SCTP_HAS_NAT_SUPPORT:
+			if (padded_size != sizeof(struct sctp_paramhdr)) {
+				SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error nat support %d\n", plen);
+				goto invalid_size;
+			}
 			*nat_friendly = 1;
-			/* fall through */
+			at += padded_size;
+			break;
 		case SCTP_PRSCTP_SUPPORTED:
 			if (padded_size != sizeof(struct sctp_paramhdr)) {
-				SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error prsctp/nat support %d\n", plen);
+				SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error prsctp %d\n", plen);
 				goto invalid_size;
 			}
 			at += padded_size;