[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);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-28 18:07:51 +02:00
parent 8f050e66fd
commit ddb56e8cca

View File

@ -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))
{