| From: | Sehrope Sarkuni <sehrope(at)jackdb(dot)com> |
|---|---|
| To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
| Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Replace px_memset() with explicit_bzero() |
| Date: | 2026-08-25 12:27:54 |
| Message-ID: | CAH7T-aqZE9O+9YK8CPzcuFjOu_1wBxjhnjNR_MAFiunQDYZ06g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
I eyeballed the patch. Looks mechanical and fine.
One thing stood out, but it's from the existing code:
diff --git a/contrib/pgcrypto/crypt-sha.c b/contrib/pgcrypto/crypt-sha.c
index 8191ba02b23..eab86f8206c 100644
--- a/contrib/pgcrypto/crypt-sha.c
+++ b/contrib/pgcrypto/crypt-sha.c
@@ -477,7 +477,7 @@ px_crypt_shacrypt(const char *pw, const char *salt,
char *passwd, unsigned dstle
memcpy(cp, sha_buf_tmp, block);
/* Make sure we don't leave something important behind */
- px_memset(&sha_buf_tmp, 0, sizeof sha_buf);
+ explicit_bzero(&sha_buf_tmp, sizeof sha_buf);
/*-
* 21. Repeat a loop according to the number specified in the rounds=<N>
That's sha_buf in the sizeof but we're zeroing out sha_buf_tmp.
They're both of length PX_SHACRYPT_DIGEST_MAX_LEN so the result is the
same. It just reads weird.
Might as well fix that now too if going to touch that line.
Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | https://www.jackdb.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-08-25 12:33:30 | Re: right() returns the whole string for the most negative n |
| Previous Message | Dagfinn Ilmari Mannsåker | 2026-08-25 12:18:33 | Re: right() returns the whole string for the most negative n |