pgsql: Fix type confusion in guc_var_compare()

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix type confusion in guc_var_compare()
Date: 2024-07-15 16:40:55
Message-ID: E1sTOkx-001m80-Er@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix type confusion in guc_var_compare()

Before this change guc_var_compare() cast the input arguments to
const struct config_generic *. That's not quite right however, as the input
on one side is often just a char * on one side.

Instead just use char *, the first field in config_generic.

This fixes a -Warray-bounds warning with some versions of gcc. While the
warning is only known to be triggered for <= 15, the issue the warning points
out seems real, so apply the fix everywhere.

Author: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Reported-by: Erik Rijkers <er(at)xs4all(dot)nl>
Suggested-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/a74a1a0d-0fd2-3649-5224-4f754e8f91aa%40xs4all.nl

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b9f3db23b7b5c7f522162e16482b096d9c930f80

Modified Files
--------------
src/backend/utils/misc/guc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2024-07-15 19:12:50 pgsql: Add missing RestrictSearchPath() calls.
Previous Message Tom Lane 2024-07-15 15:59:55 pgsql: Doc: minor improvements for plpgsql "Transaction Management" sec