Module: wine Branch: master Commit: fce67d1ec2d3b82c0d07c2a905192363fd9d1955 URL: https://gitlab.winehq.org/wine/wine/-/commit/fce67d1ec2d3b82c0d07c2a90519236...
Author: Eric Pouech epouech@codeweavers.com Date: Wed Nov 8 09:27:26 2023 +0100
wintrust: Use SecureZeroMemory() to clear magic fields.
Signed-off-by: Eric Pouech epouech@codeweavers.com
---
dlls/wintrust/crypt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/wintrust/crypt.c b/dlls/wintrust/crypt.c index dec945fe1e5..7321b84eea4 100644 --- a/dlls/wintrust/crypt.c +++ b/dlls/wintrust/crypt.c @@ -424,7 +424,8 @@ BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin, SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - ci->magic = 0; + /* Ensure compiler doesn't optimize out the assignment with 0. */ + SecureZeroMemory(&ci->magic, sizeof(ci->magic)); free(ci); return TRUE; } @@ -455,7 +456,8 @@ BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags ) return FALSE; } if (ca->find != INVALID_HANDLE_VALUE) FindClose(ca->find); - ca->magic = 0; + /* Ensure compiler doesn't optimize out the assignment with 0. */ + SecureZeroMemory(&ca->magic, sizeof(ca->magic)); free(ca); return TRUE; } @@ -555,7 +557,8 @@ BOOL WINAPI CryptCATClose(HANDLE hCatalog) free(cc->inner); CryptMsgClose(cc->msg);
- cc->magic = 0; + /* Ensure compiler doesn't optimize out the assignment with 0. */ + SecureZeroMemory(&cc->magic, sizeof(cc->magic)); free(cc); return TRUE; }