Skip to content

Commit ef6c8d6

Browse files
marceloleitnerdavem330
authored andcommitted
sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
When SCTP handles an INIT chunk, it calls for example: sctp_sf_do_5_1B_init sctp_verify_init sctp_verify_param sctp_process_init sctp_process_param handling of SCTP_PARAM_SET_PRIMARY sctp_verify_init() wasn't doing proper size validation and neither the later handling, allowing it to work over the chunk itself, possibly being uninitialized memory. Signed-off-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b6ffe76 commit ef6c8d6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

net/sctp/sm_make_chunk.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,9 +2166,16 @@ static enum sctp_ierror sctp_verify_param(struct net *net,
21662166
break;
21672167

21682168
case SCTP_PARAM_SET_PRIMARY:
2169-
if (ep->asconf_enable)
2170-
break;
2171-
goto unhandled;
2169+
if (!ep->asconf_enable)
2170+
goto unhandled;
2171+
2172+
if (ntohs(param.p->length) < sizeof(struct sctp_addip_param) +
2173+
sizeof(struct sctp_paramhdr)) {
2174+
sctp_process_inv_paramlength(asoc, param.p,
2175+
chunk, err_chunk);
2176+
retval = SCTP_IERROR_ABORT;
2177+
}
2178+
break;
21722179

21732180
case SCTP_PARAM_HOST_NAME_ADDRESS:
21742181
/* Tell the peer, we won't support this param. */

0 commit comments

Comments
 (0)