Applying same fix as in dtls1_process_out_of_seq_message. A truncated DTLS fragment...
authorMatt Caswell <matt@openssl.org>
Thu, 24 Jul 2014 22:54:28 +0000 (23:54 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 6 Aug 2014 19:36:40 +0000 (20:36 +0100)
Problem identified by Emilia Käsper, based on previous issue/patch by Adam
Langley.

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

index 29df26e99a35f054081240dfae844f40e297fd5a..c195ee0f55888c2f070e4f7123a0c539c1e246fc 100644 (file)
@@ -668,7 +668,9 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok)
        /* read the body of the fragment (header has already been read */
        i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
                frag->fragment + msg_hdr->frag_off,frag_len,0);
-       if (i<=0 || (unsigned long)i!=frag_len)
+       if ((unsigned long)i!=frag_len)
+               i=-1;
+       if (i<=0)
                goto err;
 
        RSMBLY_BITMASK_MARK(frag->reassembly, (long)msg_hdr->frag_off,