On 5/11/26 16:29, Kostiantyn Kostiuk wrote:
On Thu, Nov 5, 2026 at 2:54 PM Philippe Mathieu-Daudé <
[email protected]> wrote:
Formatting is not necessary, replace the deprecated
sprintf() by StrCpyNA() and StrCatBuffA() calls.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
qga/vss-win32/install.cpp | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index df00588c923a..1a3d5cbf75d5 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -562,7 +562,8 @@ STDAPI DllRegisterServer(void)
/* Add this module to registry */
- sprintf(key, "CLSID\\%s", g_szClsid);
+ StrCpyNA(key, "CLSID\\", sizeof(key));
+ StrCatBuffA(key, g_szClsid, sizeof(key));
MSFT does not recommend to use StrCatBuffA due to security warning.
What about using StringCchCatA instead of snprintf, even in this case?
Good point. I went back with StringCchPrintfA() for less code churn.