Kaydet (Commit) 6b64ada6 authored tarafından Herbert Dürr's avatar Herbert Dürr

#i125226# disallow absolute and relative paths for DDE servers

üst 727ea069
...@@ -260,19 +260,20 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink ) ...@@ -260,19 +260,20 @@ sal_Bool SvDDEObject::Connect( SvBaseLink * pSvLink )
// check the suitability of starting the DDE server // check the suitability of starting the DDE server
const SvtSecurityOptions aSecOpts; const SvtSecurityOptions aSecOpts;
bool bForbidden = (aSecOpts.GetMacroSecurityLevel() == eNEVER_EXECUTE); bool bForbidden = (aSecOpts.GetMacroSecurityLevel() == eNEVER_EXECUTE);
bForbidden |= (bInWinExec != sal_False); bForbidden |= (sServer.SearchChar( L":./%\\") != STRING_NOTFOUND);
static const char* aBadServers[] = { "cmd", "rundll32" }; static const char* aBadServers[] = { "cmd", "rundll32" };
for( int i = 0; i < sizeof(aBadServers)/sizeof(*aBadServers); ++i) for( int i = 0; i < sizeof(aBadServers)/sizeof(*aBadServers); ++i)
bForbidden |= (sServer.CompareIgnoreCaseToAscii( aBadServers[i]) == COMPARE_EQUAL ); bForbidden |= (sServer.CompareIgnoreCaseToAscii( aBadServers[i]) == COMPARE_EQUAL);
// try to start the DDE server if it is not there already // try to start the DDE server if it is not there already
bForbidden |= (bInWinExec != sal_False);
if( !bForbidden ) if( !bForbidden )
{ {
ByteString aCmdLine( sServer, RTL_TEXTENCODING_ASCII_US ); ByteString aCmdLine( sServer, RTL_TEXTENCODING_ASCII_US );
aCmdLine.Append( ".exe " ); aCmdLine.Append( ".exe " );
aCmdLine.Append( ByteString( sTopic, RTL_TEXTENCODING_ASCII_US ) ); aCmdLine.Append( ByteString( sTopic, RTL_TEXTENCODING_ASCII_US ) );
if( WinExec( aCmdLine.GetBuffer(), SW_SHOWMINIMIZED ) < 32 ) if( WinExec( aCmdLine.GetBuffer(), SW_SHOWMINIMIZED ) < 32 ) // TODO: use CreateProcess() instead
nError = DDELINK_ERROR_APP; nError = DDELINK_ERROR_APP;
else 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