changeset 31944:68574c0269e4

Disable loading codecs from the current directory. While convenient, it is too risky.
author reimar
date Fri, 27 Aug 2010 16:28:53 +0000
parents 339f812bb844
children 0e720002f853
files loader/module.c mplayer.c
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/loader/module.c	Fri Aug 27 16:19:24 2010 +0000
+++ b/loader/module.c	Fri Aug 27 16:28:53 2010 +0000
@@ -381,6 +381,10 @@
 //	if(fs_installed==0)
 //	    install_fs();
 
+	// Do not load libraries from a path relative to the current directory
+	if (*libname != '/')
+	    i++;
+
 	while (wm == 0 && listpath[++i])
 	{
 	    if (i < 2)
--- a/mplayer.c	Fri Aug 27 16:19:24 2010 +0000
+++ b/mplayer.c	Fri Aug 27 16:28:53 2010 +0000
@@ -2768,9 +2768,13 @@
 	{
 		HMODULE kernel32 = GetModuleHandle("Kernel32.dll");
 		BOOL WINAPI (*setDEP)(DWORD) = NULL;
-		if (kernel32)
+		BOOL WINAPI (*setDllDir)(LPCTSTR) = NULL;
+		if (kernel32) {
 			setDEP = GetProcAddress(kernel32, "SetProcessDEPPolicy");
+			setDllDir = GetProcAddress(kernel32, "SetDllDirectory");
+		}
 		if (setDEP) setDEP(3);
+		if (setDllDir) setDllDir("");
 	}
 	// stop Windows from showing all kinds of annoying error dialogs
 	SetErrorMode(0x8003);