diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/ssl_pkt.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c index 6d1a8481ee..a58a4b6656 100644 --- a/src/lib/libssl/ssl_pkt.c +++ b/src/lib/libssl/ssl_pkt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_pkt.c,v 1.3 2017/01/26 06:39:08 beck Exp $ */ | 1 | /* $OpenBSD: ssl_pkt.c,v 1.4 2017/01/26 07:20:57 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -337,7 +337,7 @@ ssl3_get_record(SSL *s) | |||
| 337 | rr = &(S3I(s)->rrec); | 337 | rr = &(S3I(s)->rrec); |
| 338 | sess = s->session; | 338 | sess = s->session; |
| 339 | 339 | ||
| 340 | again: | 340 | again: |
| 341 | /* check if we have the header */ | 341 | /* check if we have the header */ |
| 342 | if ((s->internal->rstate != SSL_ST_READ_BODY) || | 342 | if ((s->internal->rstate != SSL_ST_READ_BODY) || |
| 343 | (s->internal->packet_length < SSL3_RT_HEADER_LENGTH)) { | 343 | (s->internal->packet_length < SSL3_RT_HEADER_LENGTH)) { |
| @@ -535,9 +535,26 @@ again: | |||
| 535 | /* we have pulled in a full packet so zero things */ | 535 | /* we have pulled in a full packet so zero things */ |
| 536 | s->internal->packet_length = 0; | 536 | s->internal->packet_length = 0; |
| 537 | 537 | ||
| 538 | /* just read a 0 length packet */ | 538 | if (rr->length == 0) { |
| 539 | if (rr->length == 0) | 539 | /* |
| 540 | * CBC countermeasures for known IV weaknesses | ||
| 541 | * can legitimately insert single empty record, | ||
| 542 | * so we allow ourselves to read once past a single | ||
| 543 | * empty record without forcing want_read. | ||
| 544 | */ | ||
| 545 | if (s->internal->empty_record_count++ > SSL_MAX_EMPTY_RECORDS) { | ||
| 546 | SSLerr(SSL_F_SSL3_GET_RECORD, | ||
| 547 | SSL_R_PEER_BEHAVING_BADLY); | ||
| 548 | return -1; | ||
| 549 | } | ||
| 550 | if (s->internal->empty_record_count > 1) { | ||
| 551 | ssl_force_want_read(s); | ||
| 552 | return -1; | ||
| 553 | } | ||
| 540 | goto again; | 554 | goto again; |
| 555 | } else { | ||
| 556 | s->internal->empty_record_count = 0; | ||
| 557 | } | ||
| 541 | 558 | ||
| 542 | return (1); | 559 | return (1); |
| 543 | 560 | ||
