Apparently URLs contain exploits these days.
Thanks djpohly for fixing.
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
#include "archutils/Unix/AssertionHandler.h"
|
#include "archutils/Unix/AssertionHandler.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#if defined(CRASH_HANDLER)
|
#if defined(CRASH_HANDLER)
|
||||||
#include "archutils/Unix/CrashHandler.h"
|
#include "archutils/Unix/CrashHandler.h"
|
||||||
@@ -200,9 +202,27 @@ void ArchHooks_Unix::Init()
|
|||||||
|
|
||||||
bool ArchHooks_Unix::GoToURL( RString sUrl )
|
bool ArchHooks_Unix::GoToURL( RString sUrl )
|
||||||
{
|
{
|
||||||
RString command = "xdg-open " + sUrl;
|
int status;
|
||||||
int result = system( command.c_str() );
|
pid_t p = fork();
|
||||||
return result != -1 && WEXITSTATUS( result ) == 0;
|
if ( p == -1 )
|
||||||
|
{
|
||||||
|
// Call to fork failed
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if ( p == 0 )
|
||||||
|
{
|
||||||
|
// Child
|
||||||
|
const char * const argv[] = { "xdg-open", sUrl.c_str(), NULL };
|
||||||
|
execv( "/usr/bin/xdg-open", const_cast<char * const *>( argv ));
|
||||||
|
// If we reach here, the call to execvp failed
|
||||||
|
exit( 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Parent
|
||||||
|
waitpid( p, &status, 0 );
|
||||||
|
return WEXITSTATUS( status ) == 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _CS_GNU_LIBC_VERSION
|
#ifndef _CS_GNU_LIBC_VERSION
|
||||||
|
|||||||
Reference in New Issue
Block a user