From: Dr. Stephen Henson Date: Sat, 16 May 2009 16:18:19 +0000 (+0000) Subject: Update from 1.0.0-stable X-Git-Tag: OpenSSL-fips-2_0-rc1~1661 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8d932f6fd7df8a622f3cb998dab1529247158706;p=oweals%2Fopenssl.git Update from 1.0.0-stable --- diff --git a/crypto/pqueue/pqueue.c b/crypto/pqueue/pqueue.c index c20bc6fc96..99a6fb874d 100644 --- a/crypto/pqueue/pqueue.c +++ b/crypto/pqueue/pqueue.c @@ -237,3 +237,17 @@ pqueue_next(pitem **item) return ret; } + +int +pqueue_size(pqueue_s *pq) +{ + pitem *item = pq->items; + int count = 0; + + while(item != NULL) + { + count++; + item = item->next; + } + return count; +} diff --git a/crypto/pqueue/pqueue.h b/crypto/pqueue/pqueue.h index 7a293c8584..87fc9037c8 100644 --- a/crypto/pqueue/pqueue.h +++ b/crypto/pqueue/pqueue.h @@ -89,5 +89,6 @@ pitem *pqueue_iterator(pqueue pq); pitem *pqueue_next(piterator *iter); void pqueue_print(pqueue pq); +int pqueue_size(pqueue pq); #endif /* ! HEADER_PQUEUE_H */ diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c index b53e07d23c..a89edbc7a7 100644 --- a/ssl/d1_pkt.c +++ b/ssl/d1_pkt.c @@ -207,6 +207,10 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) DTLS1_RECORD_DATA *rdata; pitem *item; + /* Limit the size of the queue to prevent DOS attacks */ + if (pqueue_size(queue->q) >= 100) + return 0; + rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA)); item = pitem_new(priority, rdata); if (rdata == NULL || item == NULL)