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

From Aleksander Alekseev
Subject Re: Don't pass NULL pointer to strcmp().
Date
Msg-id CAJ7c6TPAF6xthpQ1yXgV=aQvqoXz_GnAT7m85uMgBTqR7jAzjw@mail.gmail.com
Whole thread Raw
In response to Re: Don't pass NULL pointer to strcmp().  (Junwang Zhao <zhjwpku@gmail.com>)
Responses Re: Don't pass NULL pointer to strcmp().
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Vik Fearing
Date:
Subject: Re: MERGE ... RETURNING
Next
From: Aleksander Alekseev
Date:
Subject: Re: Commitfest manager November 2023