diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2010-09-15 22:49:01 +0800 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2010-09-15 22:49:01 +0800 |
commit | 64f53f1a536cd871b2948cbea30869d68b37f98e (patch) | |
tree | 9a23c1d30d0bc30cefb73d1489b2a62149cc9592 /calendar/gui | |
parent | 5310e4a0b10ded4c77ce9dfaff49d3e99e327462 (diff) | |
download | gsoc2013-evolution-64f53f1a536cd871b2948cbea30869d68b37f98e.tar gsoc2013-evolution-64f53f1a536cd871b2948cbea30869d68b37f98e.tar.gz gsoc2013-evolution-64f53f1a536cd871b2948cbea30869d68b37f98e.tar.bz2 gsoc2013-evolution-64f53f1a536cd871b2948cbea30869d68b37f98e.tar.lz gsoc2013-evolution-64f53f1a536cd871b2948cbea30869d68b37f98e.tar.xz gsoc2013-evolution-64f53f1a536cd871b2948cbea30869d68b37f98e.tar.zst gsoc2013-evolution-64f53f1a536cd871b2948cbea30869d68b37f98e.zip |
Increase safety on Windows
Call SetDllDirectory() to reduce risk of DLL hijacking, and call SetProcessDEPPolicy() to reduce risk of rogue code execution.
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/alarm-notify/notify-main.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index 8c56abaff2..ad1a1178f8 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -35,12 +35,24 @@ #include <libedataserver/e-source.h> #include <libedataserverui/e-passwords.h> -#include "e-util/e-util-private.h" #include "alarm.h" #include "alarm-queue.h" #include "alarm-notify.h" #include "config-data.h" +#ifdef G_OS_WIN32 +#include <windows.h> +#include <conio.h> +#ifndef PROCESS_DEP_ENABLE +#define PROCESS_DEP_ENABLE 0x00000001 +#endif +#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION +#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002 +#endif +#endif + +#include "e-util/e-util-private.h" + gint main (gint argc, gchar **argv) { @@ -49,6 +61,26 @@ main (gint argc, gchar **argv) UniqueApp *app; #ifdef G_OS_WIN32 gchar *path; + + /* Reduce risks */ + { + typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName); + t_SetDllDirectoryA p_SetDllDirectoryA; + + p_SetDllDirectoryA = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetDllDirectoryA"); + if (p_SetDllDirectoryA) + (*p_SetDllDirectoryA) (""); + } +#ifndef _WIN64 + { + typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags); + t_SetProcessDEPPolicy p_SetProcessDEPPolicy; + + p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetProcessDEPPolicy"); + if (p_SetProcessDEPPolicy) + (*p_SetProcessDEPPolicy) (PROCESS_DEP_ENABLE|PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION); + } +#endif #endif bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); |