From ae8ea0c0c11c77590c20558f4e358baec320c195 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 2 Mar 2021 19:32:39 +0100 Subject: [PATCH] BUG/MINOR: ssl: don't truncate the file descriptor to 16 bits in debug mode Errors reported by ssl_sock_dump_errors() to stderr would only report the 16 lower bits of the file descriptor because it used to be casted to ushort. This can be backported to all versions but has really no importance in practice since this is never seen. (cherry picked from commit 566cebc1fc4f9908a47a1924c80ff32460543a49) Signed-off-by: Willy Tarreau (cherry picked from commit 07451aceab1ea0863b06f57629b618961edbb3ab) Signed-off-by: Christopher Faulet (cherry picked from commit 58da3d4ff2578ee6092c1acbfaa4b851f68d5475) Signed-off-by: Christopher Faulet --- src/ssl_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 550589f..5887d95 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -461,8 +461,8 @@ static forceinline void ssl_sock_dump_errors(struct connection *conn) ret = ERR_get_error(); if (ret == 0) return; - fprintf(stderr, "fd[%04x] OpenSSL error[0x%lx] %s: %s\n", - (unsigned short)conn->handle.fd, ret, + fprintf(stderr, "fd[%#x] OpenSSL error[0x%lx] %s: %s\n", + conn->handle.fd, ret, ERR_func_error_string(ret), ERR_reason_error_string(ret)); } } -- 1.7.10.4