Skip to content

Commit 649dc92

Browse files
committed
fix uninitialized variable
1 parent b130956 commit 649dc92

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/libpq/auth-scram.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -969,25 +969,25 @@ generate_nonce(char *result, int len)
969969
/* Use the salt generated for SASL authentication */
970970
memset(result, 0, len);
971971
if (MyProcPort == NULL) {
972-
int count;
972+
int count = 0;
973973
/* compute the salt to use for computing responses */
974974
while (count < sizeof(MyProcPort->SASLSalt) && count < len)
975975
{
976-
char byte;
976+
char byte;
977977
if (!pg_strong_random(&byte, 1))
978978
{
979979
elog(ERROR, "Could not generate random salt");
980-
}
980+
}
981981
/*
982982
* Only ASCII printable characters, except commas are accepted in
983983
* the nonce.
984984
*/
985985
if (byte < '!' || byte > '~' || byte == ',')
986986
continue;
987-
987+
988988
result[count++] = byte;
989989
}
990-
} else {
990+
} else {
991991
memcpy(result, MyProcPort->SASLSalt, Min(sizeof(MyProcPort->SASLSalt), len));
992992
}
993993
}

0 commit comments

Comments
 (0)