Make GetConfigOption/GetConfigOptionResetString return "" for NULL.
Tom Lane <tgl@sss.pgh.pa.us>
Make GetConfigOption/GetConfigOptionResetString return "" for NULL. As per the preceding commit, GUC APIs generally expose NULL-valued string variables as empty strings. Extend that policy to GetConfigOption() and GetConfigOptionResetString(), eliminating a crash hazard for unwary callers, as well as a fundamental ambiguity in GetConfigOption()'s API. No back-patch, since this is an API change and conceivably somebody somewhere is depending on this corner case. Xing Guo, Aleksander Alekseev, Tom Lane Discussion: https://postgr.es/m/CACpMh+AyDx5YUpPaAgzVwC1d8zfOL4JoD-uyFDnNSa1z0EsDQQ@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/misc/guc.c | modified | +5 −4 |
Discussion
- Don't pass NULL pointer to strcmp(). 14 messages · 2023-11-01 → 2023-11-02