Re: Don't pass NULL pointer to strcmp(). - Mailing list pgsql-hackers

From Xing Guo
Subject Re: Don't pass NULL pointer to strcmp().
Date
Msg-id CACpMh+D7yZs4t17usc+rmvA1PjwbNqX7+4C+pDoSO++PSCfing@mail.gmail.com
Whole thread Raw
In response to Re: Don't pass NULL pointer to strcmp().  (Aleksander Alekseev <aleksander@timescale.com>)
Responses Re: Don't pass NULL pointer to strcmp().
List pgsql-hackers
Hi Aleksander and Junwang,

Thanks for your comments. I have updated the patch accordingly.

Best Regards,
Xing








On Wed, Nov 1, 2023 at 7:44 PM Aleksander Alekseev <aleksander@timescale.com> wrote:
Hi,

> > I found that there's a nullable pointer being passed to strcmp() and
> > can make the server crash. It can be reproduced on the latest master
> > branch by crafting an extension[1]. Patch for fixing it is attatched.
> >
> > [1] https://github.com/higuoxing/guc_crash/tree/pg

Thanks for reporting. I can confirm that the issue reproduces on the
`master` branch and the proposed patch fixes it.

> Can we set a string guc to NULL? If not, `*lconf->variable == NULL` would
> be unnecessary.

Judging by the rest of the code we better keep it, at least for consistenc.

I see one more place with a similar code in guc.c around line 1472.
Although I don't have exact steps to trigger a crash I suggest adding
a similar check there.

--
Best regards,
Aleksander Alekseev
Attachment

pgsql-hackers by date:

Previous
From: Jakub Wartak
Date:
Subject: Re: trying again to get incremental backup
Next
From: Ashutosh Bapat
Date:
Subject: Re: speed up a logical replica setup