Skip to content

Commit

Permalink
dtls.c: Fix handling ClientHello if no peer and fragment
Browse files Browse the repository at this point in the history
If a fragmented ClientHello is received with no peer, do not handle it.

Signed-off-by: Jon Shallow <[email protected]>
  • Loading branch information
mrdeep1 committed Mar 24, 2021
1 parent 94205ff commit ddcc45b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -3676,6 +3676,11 @@ handle_handshake(dtls_context_t *ctx, dtls_peer_t *peer, session_t *session,
size_t fragment_offset = dtls_uint24_to_int(hs_header->fragment_offset);

if (packet_length > fragment_length){
if (!peer || !peer->handshake_params) {
/* This is the initial ClientHello */
dtls_alert("Cannot handle fragmented ClientHello\n");
return dtls_alert_fatal_create(DTLS_ALERT_HANDSHAKE_FAILURE);
}
dtls_debug("received fragmented handshake packet: length %zu, fragment length %zu.\n",
packet_length, fragment_length);
/* If (reassembled) packet is larger than our buffer, drop with error */
Expand Down

0 comments on commit ddcc45b

Please sign in to comment.