Fix memory leak from zero-length DTLS fragments.
authorAdam Langley <agl@imperialviolet.org>
Fri, 6 Jun 2014 21:30:33 +0000 (14:30 -0700)
committerMatt Caswell <matt@openssl.org>
Wed, 6 Aug 2014 19:36:40 +0000 (20:36 +0100)
commitd0a4b7d1a2948fce38515b8d862f43e7ba0ebf74
tree53cac245a28fc2ca9f88427a7e8979e02a617243
parent1250f12613b61758675848f6600ebd914ccd7636
Fix memory leak from zero-length DTLS fragments.

The |pqueue_insert| function can fail if one attempts to insert a
duplicate sequence number. When handling a fragment of an out of
sequence message, |dtls1_process_out_of_seq_message| would not call
|dtls1_reassemble_fragment| if the fragment's length was zero. It would
then allocate a fresh fragment and attempt to insert it, but ignore the
return value, leaking the fragment.

This allows an attacker to exhaust the memory of a DTLS peer.

Fixes CVE-2014-3507

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
ssl/d1_both.c