On 08.03.24 01:46, Tom Lane wrote:
Daniel Gustafsson <dan...@yesql.se> writes:
On 7 Mar 2024, at 20:58, Tom Lane <t...@sss.pgh.pa.us> wrote:
This could probably do with a comment, and we need to propagate
the fix into libpq's copy of the function too.  Barring objections,
I'll take care of that and push it later today.

LGTM.

Done so far as be-secure-openssl.c and fe-secure-openssl.c are
concerned.

I noticed that this change uses not-thread-safe strerror() in libpq code.

Perhaps something like this would be better (and simpler):

diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c
index 5c867106fb0..14cd9ce404d 100644
--- a/src/interfaces/libpq/fe-secure-openssl.c
+++ b/src/interfaces/libpq/fe-secure-openssl.c
@@ -1767,7 +1767,7 @@ SSLerrmessage(unsigned long ecode)
 #ifdef ERR_SYSTEM_ERROR
    if (ERR_SYSTEM_ERROR(ecode))
    {
-       strlcpy(errbuf, strerror(ERR_GET_REASON(ecode)), SSL_ERR_LEN);
+       strerror_r(ERR_GET_REASON(ecode), errbuf, SSL_ERR_LEN);
        return errbuf;
    }
 #endif



Reply via email to