diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-09-08 18:20:36 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-09-08 18:20:36 -0400 |
commit | 930b785d40cf53d679c72ffc2c34a63d412bee5b (patch) | |
tree | 16a1c2346e235ff05ae77a273ba56e3fe680df19 /src/backend/libpq/auth-scram.c | |
parent | 3985b75dca6d1101cc4cb6e78456dc6c5f72fcac (diff) | |
download | postgresql-930b785d40cf53d679c72ffc2c34a63d412bee5b.tar.gz postgresql-930b785d40cf53d679c72ffc2c34a63d412bee5b.zip |
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
Diffstat (limited to 'src/backend/libpq/auth-scram.c')
-rw-r--r-- | src/backend/libpq/auth-scram.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/libpq/auth-scram.c b/src/backend/libpq/auth-scram.c index 7cd31ebe8e2..d69d7dde06a 100644 --- a/src/backend/libpq/auth-scram.c +++ b/src/backend/libpq/auth-scram.c @@ -382,7 +382,7 @@ pg_be_scram_exchange(void *opaq, char *input, int inputlen, char * pg_be_scram_build_verifier(const char *password) { - char *prep_password = NULL; + char *prep_password; pg_saslprep_rc rc; char saltbuf[SCRAM_DEFAULT_SALT_LEN]; char *result; @@ -428,7 +428,7 @@ scram_verify_plain_password(const char *username, const char *password, uint8 stored_key[SCRAM_KEY_LEN]; uint8 server_key[SCRAM_KEY_LEN]; uint8 computed_key[SCRAM_KEY_LEN]; - char *prep_password = NULL; + char *prep_password; pg_saslprep_rc rc; if (!parse_scram_verifier(verifier, &iterations, &encoded_salt, |