Re: Fix error handling in be_tls_open_server()
Sergey Shinderuk <s.shinderuk@postgrespro.ru>
From: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-24T08:11:49Z
Lists: pgsql-hackers
On 23.08.2023 16:23, Daniel Gustafsson wrote: >> On 1 Aug 2023, at 16:44, Sergey Shinderuk <s.shinderuk@postgrespro.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. Initially I tried to trigger a crash by generating a certificate without a CN and with a DN contaning the null byte. But as I said, the error condition "SSL certificate's distinguished name contains embedded null" isn't really reachable, because XN_FLAG_RFC2253 escapes null bytes. -- Sergey Shinderuk https://postgrespro.com/
Commits
-
Avoid potential pfree on NULL on OpenSSL errors
- f720875a4670 16.1 landed
- 9dc85806d8be 15.5 landed
- 5f3aa309a880 17.0 landed