Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>,
pgsql-bugs@lists.postgresql.org
Date: 2025-01-12T16:20:23Z
Lists: pgsql-bugs
> On 12 Jan 2025, at 16:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <daniel@yesql.se> writes:
>> I'm planning to do it today, so no need to add it. Thanks!
>
> Our weekly Coverity run complained about this in all branches:
>
> *** CID 181934: Memory - corruptions (OVERRUN)
> /srv/coverity/git/pgsql-git/13stable/src/backend/libpq/hba.c: 2368 in gethba_options()
> 2362 if (hba->ldapsearchfilter)
> 2363 options[noptions++] =
> 2364 CStringGetTextDatum(psprintf("ldapsearchfilter=%s",
> 2365 hba->ldapsearchfilter));
> 2366
> 2367 if (hba->ldapscope)
>>>> CID 181934: Memory - corruptions (OVERRUN)
>>>> Overrunning array "options" of 14 8-byte elements at element index 14 (byte offset 119) using index "noptions++" (which evaluates to 14).
> 2368 options[noptions++] =
> 2369 CStringGetTextDatum(psprintf("ldapscope=%d", hba->ldapscope));
> 2370 }
> 2371
> 2372 if (hba->auth_method == uaRADIUS)
> 2373 {
>
> Looks like you should have increased MAX_HBA_OPTIONS. The comment
> just above that macro needs work too.
Ugh, I missed that when reading over the function. Thanks for the report, I'll
get it fixed tonight.
--
Daniel Gustafsson
Commits
-
Fix HBA option count
- dc24c9ad527f 17.3 landed
- 9e596a099ad4 14.16 landed
- 9ad7a32b2a15 15.11 landed
- 97698cc517c7 18.0 landed
- 7b1f50d8c87d 13.19 landed
- 116036d811cc 16.7 landed
-
Fix missing ldapscheme option in pg_hba_file_rules()
- c35bbdfbc0d3 16.7 landed
- 8ed9bf0a3217 17.3 landed
- 84b8f6d9f59a 13.19 landed
- 83ffb9f20f06 14.16 landed
- 830215a4c887 15.11 landed
- 27a1f8d10811 18.0 landed