Kaydet (Commit) d1fc4779 authored tarafından Herbert Dürr's avatar Herbert Dürr Kaydeden (comit) Caolán McNamara

Related: #i125226# disallow absolute and relative paths for DDE servers

(cherry picked from commit 6b64ada6)

Conflicts:
	sfx2/source/appl/impldde.cxx

Change-Id: I127add375a127dbbd0eaf12a10884e2636f1a332
üst 13b68e24
......@@ -25,6 +25,7 @@
#include "impldde.hxx"
#include <comphelper/string.hxx>
#include <vcl/svapp.hxx>
#include <vcl/fixed.hxx>
#include <vcl/edit.hxx>
......@@ -248,19 +249,20 @@ bool SvDDEObject::Connect( SvBaseLink * pSvLink )
// check the suitability of starting the DDE server
const SvtSecurityOptions aSecOpts;
bool bForbidden = (aSecOpts.GetMacroSecurityLevel() == eNEVER_EXECUTE);
bForbidden |= (bInWinExec != false);
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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment