Properly handle duplicated messages from the next epoch
authorMatt Caswell <matt@openssl.org>
Tue, 16 Oct 2018 16:08:11 +0000 (17:08 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 2 Nov 2018 10:00:14 +0000 (10:00 +0000)
Since 3884b47b7c we may attempt to buffer a record from the next epoch
that has already been buffered. Prior to that this never occurred.

We simply ignore a failure to buffer a duplicated record.

Fixes #6902

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7415)

ssl/d1_pkt.c

index f5deddf7706ac34ded9e6ea5b10129450bcf02f6..23aa9dbce484a8388f30f9fb1b3d72c2a0b5fb9b 100644 (file)
@@ -293,14 +293,12 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority)
         return (-1);
     }
 
-    /* insert should not fail, since duplicates are dropped */
     if (pqueue_insert(queue->q, item) == NULL) {
-        SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
+        /* Must be a duplicate so ignore it */
         if (rdata->rbuf.buf != NULL)
             OPENSSL_free(rdata->rbuf.buf);
         OPENSSL_free(rdata);
         pitem_free(item);
-        return (-1);
     }
 
     return (1);