Re: improve ssl error code, 2147483650 - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: improve ssl error code, 2147483650
Date
Msg-id 27eaa2e1-64a5-48a1-986e-bbf24672b365@eisentraut.org
Whole thread Raw
In response to Re: improve ssl error code, 2147483650  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: improve ssl error code, 2147483650
Re: improve ssl error code, 2147483650
List pgsql-hackers
On 08.03.24 01:46, Tom Lane wrote:
> Daniel Gustafsson <daniel@yesql.se> writes:
>> On 7 Mar 2024, at 20:58, Tom Lane <tgl@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




pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: suspicious valgrind reports about radixtree/tidstore on arm64
Next
From: Dave Page
Date:
Subject: Re: Meson far from ready on Windows