Skip to content

Commit 8d075b6

Browse files
committed
better way to zero away sensitive data
memset could be optimized away by the compiler
1 parent 041302a commit 8d075b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/php_crypt_r.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
206206
}
207207

208208
/* Don't leave anything around in vm they could use. */
209-
memset(final, 0, sizeof(final));
209+
RtlSecureZeroMemory(final, sizeof(final));
210210

211211
/* Then something really weird... */
212212
for (i = pwl; i != 0; i >>= 1) {
@@ -288,7 +288,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
288288

289289
*p = '\0';
290290

291-
memset(final, 0, sizeof(final));
291+
RtlSecureZeroMemory(final, sizeof(final));
292292

293293

294294
_destroyCtx1:

0 commit comments

Comments
 (0)