https://git.reactos.org/?p=reactos.git;a=commitdiff;h=089d59bc6c40813430a641...
commit 089d59bc6c40813430a641f850f97c6b215858ec Author: Timo Kreuzer timo.kreuzer@reactos.org AuthorDate: Sun Apr 28 18:01:11 2019 +0200 Commit: Hervé Poussineau hpoussin@reactos.org CommitDate: Mon May 27 13:22:40 2019 +0200
[RSAENH] Use StringCbPrintfA instead of sprintf
Fixes GCC 8 warning: dll/win32/rsaenh/rsaenh.c:161:23: error: '%s' directive writing up to 259 bytes into a region of size 235 [-Werror=format-overflow=] #define RSAENH_REGKEY "Software\Wine\Crypto\RSA\%s" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dll/win32/rsaenh/rsaenh.c:161:23: note: in definition of macro 'RSAENH_REGKEY' #define RSAENH_REGKEY "Software\Wine\Crypto\RSA\%s" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dll/win32/rsaenh/rsaenh.c:1107:5: note: 'sprintf' output between 26 and 285 bytes into a destination of size 260 sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- dll/win32/rsaenh/rsaenh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dll/win32/rsaenh/rsaenh.c b/dll/win32/rsaenh/rsaenh.c index bb28c999ae..f23c8d8bc9 100644 --- a/dll/win32/rsaenh/rsaenh.c +++ b/dll/win32/rsaenh/rsaenh.c @@ -43,6 +43,7 @@ #include <objbase.h> #include <rpcproxy.h> #include <aclapi.h> +#include <strsafe.h>
WINE_DEFAULT_DEBUG_CHANNEL(crypt);
@@ -1104,7 +1105,7 @@ static BOOL create_container_key(KEYCONTAINER *pKeyContainer, REGSAM sam, HKEY * CHAR szRSABase[MAX_PATH]; HKEY hRootKey;
- sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); + StringCbPrintfA(szRSABase, sizeof(szRSABase), RSAENH_REGKEY, pKeyContainer->szName);
if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) hRootKey = HKEY_LOCAL_MACHINE;