Re: Fix error handling in be_tls_open_server()

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix error handling in be_tls_open_server()
Date: 2023-08-24 08:38:24
Message-ID: 243DC5A8-16A2-4BF7-A43D-A84D9A32BF58@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 24 Aug 2023, at 10:11, Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru> wrote:
>
> On 23.08.2023 16:23, Daniel Gustafsson wrote:
>>> On 1 Aug 2023, at 16:44, Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru> wrote:
>>> A static analyzer reported a possible pfree(NULL) in be_tls_open_server().
>> This has the smell of a theoretical problem, I can't really imagine a
>> certificate where which would produce this. Have you been able to trigger it?
>
> I triggered a crash by generating a certificate without a CN and forcing malloc to return NULL when called from X509_NAME_print_ex or BIO_get_mem_ptr with gdb.

Can you extend the patch with that certificate and a test using it? The
certificates are generated from config files kept in the repo in src/test/ssl
in order to be reproducible.

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergey Shinderuk 2023-08-24 09:13:18 Re: Fix error handling in be_tls_open_server()
Previous Message Kyotaro Horiguchi 2023-08-24 08:15:00 Re: Should the archiver process always make sure that the timeline history files exist in the archive?