Re: Don't pass NULL pointer to strcmp().
Xing Guo <higuoxing@gmail.com>
From: Xing Guo <higuoxing@gmail.com>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>,
Junwang Zhao <zhjwpku@gmail.com>
Date: 2023-11-01T13:03:10Z
Lists: pgsql-hackers
Attachments
- v2-0001-Don-t-use-strcmp-with-nullable-pointers.patch (text/x-patch) patch v2-0001
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 >
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Make GetConfigOption/GetConfigOptionResetString return "" for NULL.
- 0bc726d95a30 17.0 landed
-
Be more wary about NULL values for GUC string variables.
- ae33659d4239 15.5 landed
- 82063edd4ac3 16.1 landed
- 7704a1a72e87 17.0 landed
- 6e1cca511348 11.22 landed
- 65810fc6d0f6 12.17 landed
- 47c0f00cf90f 14.10 landed
- 137227c6de6e 13.13 landed
-
doc: Replace reference to ERRCODE_RAISE_EXCEPTION by "raise_exception"
- 4210b55f5985 17.0 cited