sctp: improve consistency when handling chunks of wrong size

MFC after:	3 days
This commit is contained in:
Michael Tuexen 2021-05-06 01:02:41 +02:00
parent 097e8701c9
commit d1cb8d11b0

View File

@ -4840,11 +4840,12 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length,
break;
case SCTP_SHUTDOWN_ACK:
SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_ACK, stcb %p\n", (void *)stcb);
if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) {
if ((chk_length == sizeof(struct sctp_shutdown_ack_chunk)) &&
(stcb != NULL) && (netp != NULL) && (*netp != NULL)) {
sctp_handle_shutdown_ack((struct sctp_shutdown_ack_chunk *)ch, stcb, *netp);
}
*offset = length;
return (NULL);
}
break;
case SCTP_OPERATION_ERROR:
SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP_ERR\n");
@ -5032,12 +5033,13 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length,
*offset = length;
return (stcb);
}
if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) {
if ((chk_length == sizeof(struct sctp_shutdown_complete_chunk)) &&
(stcb != NULL) && (netp != NULL) && (*netp != NULL)) {
sctp_handle_shutdown_complete((struct sctp_shutdown_complete_chunk *)ch,
stcb, *netp);
}
*offset = length;
return (NULL);
}
break;
case SCTP_ASCONF:
SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF\n");