summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2014-07-09 15:23:59 +0000
committerAndras Timar <andras.timar@collabora.com>2014-07-22 11:42:23 +0200
commit9a7364955d268ea21b1353a17068627aed91d8c4 (patch)
tree14da6c54e6f435ff666e4312259ced9f9c095e8e /sfx2
parentb487607b22b6af6d9bd75ac1d61c0ff308f2256a (diff)
Related: #i125226# don't try to access known-bad DDE servers
(cherry picked from commit 88de6a59d9d7933b86fdcba733277aa4fbd5e132) Conflicts: sfx2/source/appl/impldde.cxx Change-Id: If4dcd49cfe15188d06e4e06cd8e58cdcc66ed5a4 (cherry picked from commit b16f164650f8345e51bf0b0c73bf9c8eee775bc2) Related: #i125226# some macro preferences are directly... applicable to DDE servers (cherry picked from commit 2c835e761e1e9ddb6794895e6f3538b918160dd1) Conflicts: sfx2/source/appl/impldde.cxx Change-Id: Ic16b3df34ac1b003a8a5cabab15ea655d05bdd18 Related: #i125226# typo fix (cherry picked from commit 727ea069c6342e01a50c8b068ec302574b251cbd) Conflicts: sfx2/source/appl/impldde.cxx Change-Id: I8db53b7e8529d05e660a2d69e669b44c9045712c (cherry picked from commit 13b68e24db26374ca17572de9abb429edeac32e9) Related: #i125226# disallow absolute and relative paths for DDE servers (cherry picked from commit 6b64ada6e3a902ac4b44fe49476514d49138d4d4) Conflicts: sfx2/source/appl/impldde.cxx Change-Id: I127add375a127dbbd0eaf12a10884e2636f1a332 (cherry picked from commit d1fc47793c1efbe9ff5271656283211647dd0b33) Reviewed-on: https://gerrit.libreoffice.org/10202 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/impldde.cxx19
1 files changed, 15 insertions, 4 deletions
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index cc6431d0bd3a..b0b79a21ce05 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -25,6 +25,7 @@
#include "impldde.hxx"
+#include <comphelper/string.hxx>
#include <vcl/svapp.hxx>
#include <vcl/fixed.hxx>
#include <vcl/edit.hxx>
@@ -45,6 +46,8 @@
#include <svl/svdde.hxx>
#include <sot/formats.hxx>
+#include <unotools/securityoptions.hxx>
+
#define DDELINK_ERROR_APP 1
#define DDELINK_ERROR_DATA 2
@@ -243,15 +246,23 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink )
}
#if defined(WNT)
-
- // Server not up, try once more to start it.
- if( !bInWinExec )
+ // check the suitability of starting the DDE server
+ const SvtSecurityOptions aSecOpts;
+ bool bForbidden = (aSecOpts.GetMacroSecurityLevel() == eNEVER_EXECUTE);
+ bForbidden |= (comphelper::string::indexOfAny(sServer, L":./%\\") != -1);
+ static const char* aBadServers[] = { "cmd", "rundll32" };
+ for (size_t i = 0; i < sizeof(aBadServers)/sizeof(*aBadServers); ++i)
+ bForbidden |= sServer.equalsAscii(aBadServers[i]);
+
+ // try to start the DDE server if it is not there already
+ bForbidden |= (bInWinExec != false);
+ if( !bForbidden )
{
OStringBuffer aCmdLine(OUStringToOString(sServer, RTL_TEXTENCODING_ASCII_US));
aCmdLine.append(".exe ");
aCmdLine.append(OUStringToOString(sTopic, RTL_TEXTENCODING_ASCII_US));
- if( WinExec( aCmdLine.getStr(), SW_SHOWMINIMIZED ) < 32 )
+ if( WinExec( aCmdLine.getStr(), SW_SHOWMINIMIZED ) < 32 ) // TODO: use CreateProcess() instead
nError = DDELINK_ERROR_APP;
else
{