BUG/MINOR: ssl: don't truncate the file descriptor to 16 bits in debug mode
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Mar 2021 18:32:39 +0000 (19:32 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Mar 2021 12:47:13 +0000 (13:47 +0100)
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 <w@1wt.eu>
(cherry picked from commit 07451aceab1ea0863b06f57629b618961edbb3ab)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 58da3d4ff2578ee6092c1acbfaa4b851f68d5475)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/ssl_sock.c

index 550589f..5887d95 100644 (file)
@@ -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));
                }
        }