https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ddb56e8cca52c7e7613d1…
commit ddb56e8cca52c7e7613d1648f06e5098dbc2d460
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Apr 28 18:07:51 2019 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Jul 20 13:56:18 2019 +0200
[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))
{