summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2010-08-31 08:23:30 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2010-09-03 08:22:25 (GMT)
commit5738dcd705e7edde816940f9c0ab2c364c81ad20 (patch)
treee6be0a4b0f11289a7f0e8f6b4d4cce1de28aee8e /src/gui/dialogs
parentdac9e5dd5644d29d6a8dde752e7c594727f16661 (diff)
downloadQt-5738dcd705e7edde816940f9c0ab2c364c81ad20.zip
Qt-5738dcd705e7edde816940f9c0ab2c364c81ad20.tar.gz
Qt-5738dcd705e7edde816940f9c0ab2c364c81ad20.tar.bz2
Ensure that we load system libraries from the correct location.
This was a security hole that has been there for a while, but the public awareness have recently rised so the threat is more imminent now. The solution is to fix all places where we dynamically load system libraries. More specifically, we now load all system libraries with an absolute path that points to a library in the system directory (usually c:\windows\system32). We therefore introduce a small class named QSystemLibrary that only loads libraries located in the system path. This shares some of the API with QLibrary (in order to make the patch as small as possible). We don't fix QLibrary due to risk of regressions. In addition, applications can fix the code that calls QLibrary themselves. The problem does not apply to Windows CE, since the search order is documented as not searching in the current directory. However, it touches some CE-specific code - therefore QSystemLibrary is sometimes used on WinCE (however, it will just do a normal LoadLibrary() since its safe anyway). This change does not affect the testability plugin (it is not clearly documented where that plugin is located, and the plugin should never be used in production code anyway) Loading OpenSSL libraries The ssl libraries are handled specially, and searched in this order (we cannot expect them to always be in the system folder): 1. Application path 2. System libraries path 3. Trying all paths inside the PATH environment variable Task-number: QT-3825 Reviewed-by: Thiago Macieira Reviewed-by: Peter Hartmann
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp12
-rw-r--r--src/gui/dialogs/qwizard_win.cpp6
2 files changed, 9 insertions, 9 deletions
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 5a7ace9..bd97527 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -52,7 +52,7 @@
#include <qbuffer.h>
#include <qdir.h>
#include <qstringlist.h>
-#include <qlibrary.h>
+#include <private/qsystemlibrary_p.h>
#ifndef QT_NO_THREAD
# include <private/qmutexpool_p.h>
@@ -126,10 +126,10 @@ static void qt_win_resolve_libs()
triedResolve = true;
#if !defined(Q_WS_WINCE)
- QLibrary lib(QLatin1String("shell32"));
- ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW");
- ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW");
- ptrSHGetMalloc = (PtrSHGetMalloc) lib.resolve("SHGetMalloc");
+ QSystemLibrary lib(L"shell32");
+ ptrSHBrowseForFolder = (PtrSHBrowseForFolder)lib.resolve("SHBrowseForFolderW");
+ ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)lib.resolve("SHGetPathFromIDListW");
+ ptrSHGetMalloc = (PtrSHGetMalloc)lib.resolve("SHGetMalloc");
#else
// CE stores them in a different lib and does not use unicode version
HINSTANCE handle = LoadLibraryW(L"Ceshell");
@@ -436,7 +436,7 @@ static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd,
{
if (!pSHCreateItemFromParsingName) {
// This function is available only in Vista & above.
- QLibrary shellLib(QLatin1String("Shell32"));
+ QSystemLibrary shellLib(QLatin1String("Shell32"));
pSHCreateItemFromParsingName = (PtrSHCreateItemFromParsingName)
shellLib.resolve("SHCreateItemFromParsingName");
if (!pSHCreateItemFromParsingName)
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 1390b21..449ad62 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -43,7 +43,7 @@
#ifndef QT_NO_STYLE_WINDOWSVISTA
#include "qwizard_win_p.h"
-#include "qlibrary.h"
+#include <private/qsystemlibrary_p.h>
#include "qwizard.h"
#include "qpaintengine.h"
#include "qapplication.h"
@@ -691,7 +691,7 @@ bool QVistaHelper::resolveSymbols()
static bool tried = false;
if (!tried) {
tried = true;
- QLibrary dwmLib(QString::fromAscii("dwmapi"));
+ QSystemLibrary dwmLib(L"dwmapi");
pDwmIsCompositionEnabled =
(PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
if (pDwmIsCompositionEnabled) {
@@ -699,7 +699,7 @@ bool QVistaHelper::resolveSymbols()
pDwmExtendFrameIntoClientArea =
(PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
}
- QLibrary themeLib(QString::fromAscii("uxtheme"));
+ QSystemLibrary themeLib(L"uxtheme");
pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
if (pIsAppThemed) {
pDrawThemeBackground = (PtrDrawThemeBackground)themeLib.resolve("DrawThemeBackground");