summaryrefslogtreecommitdiff
path: root/jvmfwk
diff options
context:
space:
mode:
Diffstat (limited to 'jvmfwk')
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx6
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx6
-rw-r--r--jvmfwk/source/fwkutil.cxx14
3 files changed, 14 insertions, 12 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 5d28e0240b58..7a9cefd78f34 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -485,8 +485,7 @@ static void load_msvcr(OUString const & jvm_dll, OUStringLiteral msvcr)
}
if (LoadLibraryW(
- reinterpret_cast<wchar_t const *>(
- OUString(jvm_dll.copy(0, slash+1) + msvcr).getStr())))
+ SAL_W(OUString(jvm_dll.copy(0, slash+1) + msvcr).getStr())))
return;
// Then check if msvcr71.dll is in the parent folder of where
@@ -498,8 +497,7 @@ static void load_msvcr(OUString const & jvm_dll, OUStringLiteral msvcr)
return;
LoadLibraryW(
- reinterpret_cast<wchar_t const *>(
- OUString(jvm_dll.copy(0, slash+1) + msvcr).getStr()));
+ SAL_W(OUString(jvm_dll.copy(0, slash+1) + msvcr).getStr()));
}
// Check if the jvm DLL imports msvcr71.dll, and in that case try
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index f1bf45816af6..7513716d4f90 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -631,7 +631,11 @@ bool getJavaInfoFromRegistry(const wchar_t* szRegKey,
// Find out how long the string for JavaHome is and allocate memory to hold the path
if( RegQueryValueExW(hKey, L"JavaHome", nullptr, &dwType, nullptr, &dwTmpPathLen)== ERROR_SUCCESS)
{
- unsigned char* szTmpPath= static_cast<unsigned char *>(malloc( dwTmpPathLen));
+ unsigned char* szTmpPath= static_cast<unsigned char *>(malloc(dwTmpPathLen+sizeof(sal_Unicode)));
+ // According to https://msdn.microsoft.com/en-us/ms724911, the application should ensure
+ // that the string is properly terminated before using it
+ for (DWORD i = 0; i < sizeof(sal_Unicode); ++i)
+ szTmpPath[dwTmpPathLen + i] = 0;
// Get the path for the runtime lib
if(RegQueryValueExW(hKey, L"JavaHome", nullptr, &dwType, szTmpPath, &dwTmpPathLen) == ERROR_SUCCESS)
{
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index fbb885b1d0c2..95fa21503bc0 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -66,18 +66,19 @@ bool isAccessibilitySupportDesired()
#ifdef _WIN32
bool retVal = false;
HKEY hKey = nullptr;
- if (RegOpenKeyEx(HKEY_CURRENT_USER,
- "Software\\LibreOffice\\Accessibility\\AtToolSupport",
- 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ if (RegOpenKeyExA(HKEY_CURRENT_USER,
+ "Software\\LibreOffice\\Accessibility\\AtToolSupport",
+ 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
DWORD dwType = 0;
DWORD dwLen = 16;
unsigned char arData[16];
- if( RegQueryValueEx(hKey, "SupportAssistiveTechnology", nullptr, &dwType, arData,
- & dwLen)== ERROR_SUCCESS)
+ if( RegQueryValueExA(hKey, "SupportAssistiveTechnology", nullptr, &dwType, arData,
+ &dwLen)== ERROR_SUCCESS)
{
if (dwType == REG_SZ)
{
+ arData[std::min(dwLen, DWORD(15))] = 0;
if (strcmp(reinterpret_cast<char*>(arData), "true") == 0
|| strcmp(reinterpret_cast<char*>(arData), "1") == 0)
retVal = true;
@@ -98,9 +99,8 @@ bool isAccessibilitySupportDesired()
"jfw", "bad registry value " << unsigned(arData[0]));
}
}
+ RegCloseKey(hKey);
}
- RegCloseKey(hKey);
-
#elif defined UNX
// Java is no longer required for a11y - we use atk directly.
bool retVal = ::rtl::Bootstrap::get( "JFW_PLUGIN_FORCE_ACCESSIBILITY", sValue) && sValue == "1";