diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-07-13 22:37:45 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-07-13 22:37:45 +0000 |
commit | 34d01a3b20860252c04df0197f95486d4ee8128e (patch) | |
tree | f5285099fe7b62e6d7bd3f6c5e7544c2a676ff9c /ssl/s3_pkt.c | |
parent | 856f3005def785e7f7319df6a8137c1c79c7b08e (diff) |
PR: 1984
Submitted by: Michael Tüxen <Michael.Tuexen@lurchi.franken.de>
Approved by: steve@openssl.org
PR#1984 DTLS fix for 0.9.8.
Diffstat (limited to 'ssl/s3_pkt.c')
-rw-r--r-- | ssl/s3_pkt.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index 60135ff9ac..408ab9214c 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -141,9 +141,10 @@ int ssl3_read_n(SSL *s, int n, int max, int extend) /* ... now we can act as if 'extend' was set */ } - /* extend reads should not span multiple packets for DTLS */ - if ( SSL_version(s) == DTLS1_VERSION && - extend) + /* For DTLS/UDP reads should not span multiple packets + * because the read operation returns the whole packet + * at once (as long as it fits into the buffer). */ + if (SSL_version(s) == DTLS1_VERSION) { if ( s->s3->rbuf.left > 0 && n > s->s3->rbuf.left) n = s->s3->rbuf.left; @@ -209,6 +210,14 @@ int ssl3_read_n(SSL *s, int n, int max, int extend) return(i); } newb+=i; + /* reads should *never* span multiple packets for DTLS because + * the underlying transport protocol is message oriented as opposed + * to byte oriented as in the TLS case. */ + if (SSL_version(s) == DTLS1_VERSION) + { + if (n > newb) + n = newb; /* makes the while condition false */ + } } /* done reading, now the book-keeping */ |