Skip to content

Commit affd38e

Browse files
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
1 parent 9e02005 commit affd38e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

contrib/pgcrypto/crypt-md5.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ _crypt_to64(char *s, unsigned long v, int n)
3333
char *
3434
px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
3535
{
36-
static char *magic = "$1$"; /* This string is magic for this algorithm.
37-
* Having it this way, we can get better later
38-
* on */
39-
static char *p;
40-
static const char *sp,
36+
static const char *magic = "$1$"; /* This string is magic for this
37+
* algorithm. Having it this way, we
38+
* can get better later on */
39+
char *p;
40+
const char *sp,
4141
*ep;
4242
unsigned char final[MD5_SIZE];
4343
int sl,
@@ -81,7 +81,7 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
8181
px_md_update(ctx, (const uint8 *) pw, strlen(pw));
8282

8383
/* Then our magic string */
84-
px_md_update(ctx, (uint8 *) magic, strlen(magic));
84+
px_md_update(ctx, (const uint8 *) magic, strlen(magic));
8585

8686
/* Then the raw salt */
8787
px_md_update(ctx, (const uint8 *) sp, sl);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy