Skip to content

Commit

Permalink
[FIX] When protocol in DCEP header of data channel open command is no…
Browse files Browse the repository at this point in the history
…t empty, there is a check preventing the data channel to be opened. Now protocol length is correctly handled to avoid check failing. (#1228)
  • Loading branch information
ela34 authored and disa6302 committed Dec 5, 2023
1 parent 342ec21 commit c141539
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/source/Sctp/Sctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ STATUS handleDcepPacket(PSctpSession pSctpSession, UINT32 streamId, PBYTE data,

// Assert that is DCEP of type DataChannelOpen
CHK(length > SCTP_DCEP_HEADER_LENGTH && data[0] == DCEP_DATA_CHANNEL_OPEN, STATUS_SUCCESS);

MEMCPY(&labelLength, data + 8, SIZEOF(UINT16));
MEMCPY(&protocolLength, data + 10, SIZEOF(UINT16));
putInt16((PINT16) &labelLength, labelLength);
Expand All @@ -318,7 +318,6 @@ STATUS handleDcepPacket(PSctpSession pSctpSession, UINT32 streamId, PBYTE data,
CHK((labelLength + protocolLength + SCTP_DCEP_HEADER_LENGTH) >= length, STATUS_SCTP_INVALID_DCEP_PACKET);

CHK(SCTP_MAX_ALLOWABLE_PACKET_LENGTH >= length, STATUS_SCTP_INVALID_DCEP_PACKET);

pSctpSession->sctpSessionCallbacks.dataChannelOpenFunc(pSctpSession->sctpSessionCallbacks.customData, streamId, data + SCTP_DCEP_HEADER_LENGTH,
labelLength);

Expand Down

0 comments on commit c141539

Please sign in to comment.