From 2784652ab880dcea82aa212096b64d39695012fc Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 5 Apr 2015 22:21:59 +0200 Subject: Windows vulnerability fix: CryptAcquireContext vulnerability fix. Add checks to random generator to abort in case of error and display a diagnose message to the user. --- src/Format/Tcformat.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Format/Tcformat.c') diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 80fc6d00..b32ce0ce 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -9000,7 +9000,15 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm nPbar = IDC_PROGRESS_BAR; if (Randinit ()) - AbortProcess ("INIT_RAND"); + { + DWORD dwLastError = GetLastError (); + wchar_t szTmp[4096]; + if (CryptoAPILastError == ERROR_SUCCESS) + StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, dwLastError); + else + StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CAPI_RAND"), SRC_POS, CryptoAPILastError); + AbortProcessDirect (szTmp); + } RegisterRedTick(hInstance); -- cgit v1.2.3