[libpeas] Prevent having untrusted python modules in the search path



commit 664d5e2ad22ac1acc39bdcf9186dc8ce734c0fcf
Author: Garrett Regier <alias301 gmail com>
Date:   Thu Jul 22 04:49:36 2010 -0700

    Prevent having untrusted python modules in the search path
    
    https://bugzilla.gnome.org/show_bug.cgi?id=569214

 loaders/python/peas-plugin-loader-python.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 716f9c6..cf3aba0 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -449,7 +449,12 @@ peas_python_init (PeasPluginLoaderPython *loader)
   if (prgname != NULL)
     argv[0] = prgname;
 
+#if PY_VERSION_HEX < 0x02060600
   PySys_SetArgv (1, argv);
+  PyRun_SimpleString ("import sys; sys.path.pop(0)\n");
+#else
+  PySys_SetArgvEx (1, argv, 0);
+#endif
 
   /* Note that we don't call this with the GIL held, since we haven't initialised pygobject yet */
   peas_plugin_loader_python_add_module_path (loader, PEAS_PYEXECDIR);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]