Re: improve ssl error code, 2147483650

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, David Zhang <david(dot)zhang(at)highgo(dot)ca>, Pgsql Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: improve ssl error code, 2147483650
Date: 2024-06-21 11:15:58
Message-ID: 27eaa2e1-64a5-48a1-986e-bbf24672b365@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08.03.24 01:46, Tom Lane wrote:
> Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 7 Mar 2024, at 20:58, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2024-06-21 11:20:49 Re: Meson far from ready on Windows
Previous Message John Naylor 2024-06-21 11:06:06 Re: suspicious valgrind reports about radixtree/tidstore on arm64