From ae7ec4802a81770ff164e465b8d1fb51624ca093 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 7 Feb 2016 02:07:38 +0100 Subject: Windows:Fix various issues and warnings reported by static code analysis tool Coverity. --- src/Common/Exception.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Common/Exception.h') diff --git a/src/Common/Exception.h b/src/Common/Exception.h index a54f803d..f3635a1d 100644 --- a/src/Common/Exception.h +++ b/src/Common/Exception.h @@ -77,7 +77,7 @@ namespace VeraCrypt void Show (HWND parent) const { char szErrCode[16]; - StringCbPrintfA (szErrCode, sizeof(szErrCode), "0x%.8X", LastError); + StringCchPrintfA (szErrCode, ARRAYSIZE(szErrCode), "0x%.8X", LastError); string msgBody = "The Random Generator initialization failed.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n" + string (SrcPos) + "\nLast Error = " + string (szErrCode) + ")"; MessageBoxA (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND); } @@ -93,7 +93,7 @@ namespace VeraCrypt void Show (HWND parent) const { char szErrCode[16]; - StringCbPrintfA (szErrCode, sizeof(szErrCode), "0x%.8X", LastError); + StringCchPrintfA (szErrCode, ARRAYSIZE(szErrCode), "0x%.8X", LastError); string msgBody = "Windows Crypto API failed.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n" + string (SrcPos) + "\nLast Error = " + string (szErrCode) + ")"; MessageBoxA (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND); } -- cgit v1.2.3