diff options
author | Bruce Momjian <bruce@momjian.us> | 2014-04-17 12:37:53 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2014-04-17 12:37:53 -0400 |
commit | fc02b87e2876b2492a3d5eebd3b70be383b08f40 (patch) | |
tree | 19301491c363e8f87b15d53f1f742b5975161749 /contrib/pgcrypto/crypt-blowfish.c | |
parent | 179c45ae2fb9519a343bc2e38ebe4609097d14af (diff) | |
download | postgresql-fc02b87e2876b2492a3d5eebd3b70be383b08f40.tar.gz postgresql-fc02b87e2876b2492a3d5eebd3b70be383b08f40.zip |
pgcrypto: fix memset() calls that might be optimized away
Specifically, on-stack memset() might be removed, so:
* Replace memset() with px_memset()
* Add px_memset to copy_crlf()
* Add px_memset to pgp-s2k.c
Patch by Marko Kreen
Report by PVS-Studio
Backpatch through 8.4.
Diffstat (limited to 'contrib/pgcrypto/crypt-blowfish.c')
-rw-r--r-- | contrib/pgcrypto/crypt-blowfish.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c index eebf1877cfd..da7b620f38b 100644 --- a/contrib/pgcrypto/crypt-blowfish.c +++ b/contrib/pgcrypto/crypt-blowfish.c @@ -34,8 +34,8 @@ #include "postgres.h" -#include "px.h" #include "px-crypt.h" +#include "px.h" #ifdef __i386__ #define BF_ASM 0 /* 1 */ @@ -617,7 +617,7 @@ _crypt_blowfish_rn(const char *key, const char *setting, count = (BF_word) 1 << ((setting[4] - '0') * 10 + (setting[5] - '0')); if (count < 16 || BF_decode(data.binary.salt, &setting[7], 16)) { - memset(data.binary.salt, 0, sizeof(data.binary.salt)); + px_memset(data.binary.salt, 0, sizeof(data.binary.salt)); return NULL; } BF_swap(data.binary.salt, 4); @@ -730,7 +730,7 @@ _crypt_blowfish_rn(const char *key, const char *setting, /* Overwrite the most obvious sensitive data we have on the stack. Note * that this does not guarantee there's no sensitive data left on the * stack and/or in registers; I'm not aware of portable code that does. */ - memset(&data, 0, sizeof(data)); + px_memset(&data, 0, sizeof(data)); return output; } |