Re: Don't pass NULL pointer to strcmp().

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Junwang Zhao <zhjwpku(at)gmail(dot)com>, Xing Guo <higuoxing(at)gmail(dot)com>
Subject: Re: Don't pass NULL pointer to strcmp().
Date: 2023-11-01 11:44:07
Message-ID: CAJ7c6TPAF6xthpQ1yXgV=aQvqoXz_GnAT7m85uMgBTqR7jAzjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2023-11-01 11:58:56 Re: Commitfest manager November 2023
Previous Message Vik Fearing 2023-11-01 11:17:50 Re: MERGE ... RETURNING