diff options
| author | jsing <> | 2020-05-29 17:54:58 +0000 |
|---|---|---|
| committer | jsing <> | 2020-05-29 17:54:58 +0000 |
| commit | ed3918023e9cb56cd8b5aee0647135d4088a65b0 (patch) | |
| tree | b085a78e95308e490af531826c9e0147fb1caa30 | |
| parent | 574d6f0d7739a1810b9aad1f62716ceadbe58540 (diff) | |
| download | openbsd-ed3918023e9cb56cd8b5aee0647135d4088a65b0.tar.gz openbsd-ed3918023e9cb56cd8b5aee0647135d4088a65b0.tar.bz2 openbsd-ed3918023e9cb56cd8b5aee0647135d4088a65b0.zip | |
Handle the case where we receive a valid 0 byte application data record.
In this situation we cannot return zero bytes, as that signals EOF. Rather
we need to return TLS13_IO_WANT_POLLIN so tell the caller to call us again,
at which point we'll pull up the next record.
ok tb@
| -rw-r--r-- | src/lib/libssl/tls13_record_layer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c index 70c440fee0..5e6f8e1e5b 100644 --- a/src/lib/libssl/tls13_record_layer.c +++ b/src/lib/libssl/tls13_record_layer.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_record_layer.c,v 1.46 2020/05/26 16:54:50 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_record_layer.c,v 1.47 2020/05/29 17:54:58 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -888,6 +888,15 @@ tls13_record_layer_read_internal(struct tls13_record_layer *rl, | |||
| 888 | if (CBS_len(&rl->rbuf_cbs) == 0) { | 888 | if (CBS_len(&rl->rbuf_cbs) == 0) { |
| 889 | if ((ret = tls13_record_layer_read_record(rl)) <= 0) | 889 | if ((ret = tls13_record_layer_read_record(rl)) <= 0) |
| 890 | return ret; | 890 | return ret; |
| 891 | |||
| 892 | /* | ||
| 893 | * We may have read a valid 0-byte application data record, | ||
| 894 | * in which case we need to read the next record. | ||
| 895 | */ | ||
| 896 | if (CBS_len(&rl->rbuf_cbs) == 0) { | ||
| 897 | tls13_record_layer_rbuf_free(rl); | ||
| 898 | return TLS13_IO_WANT_POLLIN; | ||
| 899 | } | ||
| 891 | } | 900 | } |
| 892 | 901 | ||
| 893 | /* | 902 | /* |
