From f78c51995e35889d39cb0bdadcbfa3e144bd8a29 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 5 Oct 2022 15:01:18 +0100 Subject: [PATCH] Fix a return value in tls_default_read_n Reviewed-by: Hugo Landau Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/19343) --- ssl/record/methods/tls_common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ssl/record/methods/tls_common.c b/ssl/record/methods/tls_common.c index d3f64391848..dd497ed1de9 100644 --- a/ssl/record/methods/tls_common.c +++ b/ssl/record/methods/tls_common.c @@ -322,8 +322,13 @@ int tls_default_read_n(OSSL_RECORD_LAYER *rl, size_t n, size_t max, int extend, * the buffer). */ if (rl->isdtls) { - if (left == 0 && extend) - return 0; + if (left == 0 && extend) { + /* + * We received a record with a header but no body data. This will + * get dumped. + */ + return OSSL_RECORD_RETURN_NON_FATAL_ERR; + } if (left > 0 && n > left) n = left; } -- 2.47.3