From ddb56e8cca52c7e7613d1648f06e5098dbc2d460 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 28 Apr 2019 18:07:51 +0200 Subject: [PATCH] [OLEAUT32] Use snprintf instead of sprintf Fixes GCC 8 warning: dll/win32/oleaut32/oleaut.c:876:39: error: '%s' directive writing up to 99 bytes into a region of size between 92 and 291 [-Werror=format-overflow=] sprintf(typelibkey, "Typelib\\%s\\%s\\0\\win%u", tlguid, ver, sizeof(void *) == 8 ? 64 : 32); ^~ ~~~ dll/win32/oleaut32/oleaut.c:876:5: note: 'sprintf' output between 18 and 316 bytes into a destination of size 300 sprintf(typelibkey, "Typelib\\%s\\%s\\0\\win%u", tlguid, ver, sizeof(void *) == 8 ? 64 : 32); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- dll/win32/oleaut32/oleaut.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dll/win32/oleaut32/oleaut.c b/dll/win32/oleaut32/oleaut.c index 8c5d68fee29..ae76d245d24 100644 --- a/dll/win32/oleaut32/oleaut.c +++ b/dll/win32/oleaut32/oleaut.c @@ -873,7 +873,11 @@ static HRESULT reg_get_typelib_module(REFIID iid, WCHAR *module, DWORD len) RegCloseKey(ikey); +#ifndef __REACTOS__ sprintf(typelibkey, "Typelib\\%s\\%s\\0\\win%u", tlguid, ver, sizeof(void *) == 8 ? 64 : 32); +#else + snprintf(typelibkey, sizeof(typelibkey), "Typelib\\%s\\%s\\0\\win%u", tlguid, ver, sizeof(void *) == 8 ? 64 : 32); +#endif // __REACTOS__ tlfnlen = sizeof(tlfn); if (RegQueryValueA(HKEY_CLASSES_ROOT, typelibkey, tlfn, &tlfnlen)) {