mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
pgcrypto: Remove static storage class from variables
Variables p, sp and ep were labeled with static storage class but are all assigned before use so they cannot carry any data across calls. Fix by removing the static label. Also while in there, make the magic variable const as it will never change. Author: Japin Li <japinli@hotmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/ME0P300MB0445096B67ACE8CE25772F00B6F72@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
This commit is contained in:
parent
9e020050b8
commit
affd38e55a
@ -33,11 +33,11 @@ _crypt_to64(char *s, unsigned long v, int n)
|
|||||||
char *
|
char *
|
||||||
px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
|
px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
|
||||||
{
|
{
|
||||||
static char *magic = "$1$"; /* This string is magic for this algorithm.
|
static const char *magic = "$1$"; /* This string is magic for this
|
||||||
* Having it this way, we can get better later
|
* algorithm. Having it this way, we
|
||||||
* on */
|
* can get better later on */
|
||||||
static char *p;
|
char *p;
|
||||||
static const char *sp,
|
const char *sp,
|
||||||
*ep;
|
*ep;
|
||||||
unsigned char final[MD5_SIZE];
|
unsigned char final[MD5_SIZE];
|
||||||
int sl,
|
int sl,
|
||||||
@ -81,7 +81,7 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
|
|||||||
px_md_update(ctx, (const uint8 *) pw, strlen(pw));
|
px_md_update(ctx, (const uint8 *) pw, strlen(pw));
|
||||||
|
|
||||||
/* Then our magic string */
|
/* Then our magic string */
|
||||||
px_md_update(ctx, (uint8 *) magic, strlen(magic));
|
px_md_update(ctx, (const uint8 *) magic, strlen(magic));
|
||||||
|
|
||||||
/* Then the raw salt */
|
/* Then the raw salt */
|
||||||
px_md_update(ctx, (const uint8 *) sp, sl);
|
px_md_update(ctx, (const uint8 *) sp, sl);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user