[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);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-28 18:01:11 +02:00 committed by Hervé Poussineau
parent 6129fbaf1e
commit 089d59bc6c

View file

@ -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;