pgsql: Minor cleanup/future-proofing for pg_saslprep(). - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Minor cleanup/future-proofing for pg_saslprep().
Date
Msg-id E1fylb5-00007v-Uc@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Minor cleanup/future-proofing for pg_saslprep().

Ensure that pg_saslprep() initializes its output argument to NULL in
all failure paths, and then remove the redundant initialization that
some (not all) of its callers did.  This does not fix any live bug,
but it reduces the odds of future bugs of omission.

Also add a comment about why the existing failure-path coding is
adequate.

Back-patch so as to keep the function's API consistent across branches,
again to forestall future bug introduction.

Patch by me, reviewed by Michael Paquier

Discussion: https://postgr.es/m/16558.1536407783@sss.pgh.pa.us

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/930b785d40cf53d679c72ffc2c34a63d412bee5b

Modified Files
--------------
src/backend/libpq/auth-scram.c       |  4 ++--
src/common/saslprep.c                | 11 ++++++++---
src/interfaces/libpq/fe-auth-scram.c |  2 +-
3 files changed, 11 insertions(+), 6 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Remove duplicated words split across lines in comments
Next
From: Noah Misch
Date:
Subject: pgsql: Fix logical subscriber wait in test.