--- crypto/pqueue/pqueue.c 2005-06-28 14:53:33.000000000 +0200 +++ crypto/pqueue/pqueue.c 2009-05-15 16:23:49.000000000 +0200 @@ -234,3 +234,17 @@ return ret; } + +int +pqueue_size(pqueue_s *pq) +{ + pitem *item = pq->items; + int count = 0; + + while(item != NULL) + { + count++; + item = item->next; + } + return count; +} --- crypto/pqueue/pqueue.h 2005-05-31 00:34:27.000000000 +0200 +++ crypto/pqueue/pqueue.h 2009-05-15 16:23:49.000000000 +0200 @@ -91,5 +91,6 @@ pitem *pqueue_next(piterator *iter); void pqueue_print(pqueue pq); +int pqueue_size(pqueue pq); #endif /* ! HEADER_PQUEUE_H */ --- ssl/d1_pkt.c 2008-10-13 08:43:06.000000000 +0200 +++ ssl/d1_pkt.c 2009-05-15 16:23:49.000000000 +0200 @@ -167,6 +167,10 @@ 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)