summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-08-18 15:57:41 +0100
committerTomas Mraz <tomas@openssl.org>2023-08-20 13:28:33 +0200
commit72622c0b9637667cfef3692e5a63b90d637f0c72 (patch)
treea6fe2103c514f4dda6e915e15e327f299d4dcd0f
parentd561fe5a0aabb4d0a9400b5086441bb4f4b4dca4 (diff)
Handle the case where the read buffer is empty but we have received FIN
In some cases where a FIN has been received but with no data quic_read_actual was failing to raise SSL_ERROR_ZERO_RETURN. This meant that we could end up blocking in SSL_read(_ex) for too long. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21780)
-rw-r--r--ssl/quic/quic_impl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c
index cf6233fc5b..b0d613299f 100644
--- a/ssl/quic/quic_impl.c
+++ b/ssl/quic/quic_impl.c
@@ -2237,6 +2237,9 @@ static int quic_read_actual(QCTX *ctx,
stream);
}
+ if (*bytes_read == 0 && is_fin)
+ return QUIC_RAISE_NORMAL_ERROR(ctx, SSL_ERROR_ZERO_RETURN);
+
return 1;
}