about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-25 19:20:08 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-27 00:18:47 +0100
commitcae0be3af69f32eee05028ca2ee0c4b6997171af (patch)
tree52c18fa740a500b4bdbdd78040dce80dedb6fbce
parentbac2bbd05893dff4be88c7914116374c0f27932d (diff)
downloadzsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar.gz
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.tar.xz
zsh-cae0be3af69f32eee05028ca2ee0c4b6997171af.zip
34387: Avoid loading the main zsh binary as a module
-rw-r--r--ChangeLog3
-rw-r--r--Src/module.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ff7c100f8..5939ea141 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
 	* 34382: Src/module.c: Handle NULL return from dlerror() more
 	gracefully
 
+	* 34387: Src/module.c: Avoid loading the main zsh binary as
+	a module
+
 2015-01-26  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 34402: Src/Modules/db_gdbm.c: make unsetting a tied gdbm
diff --git a/Src/module.c b/Src/module.c
index 97a4869cd..7dd47016c 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1577,7 +1577,9 @@ try_load_module(char const *name)
 	if (l + (**pp ? strlen(*pp) : 1) > PATH_MAX)
 	    continue;
 	sprintf(buf, "%s/%s.%s", **pp ? *pp : ".", name, DL_EXT);
-	ret = dlopen(unmeta(buf), RTLD_LAZY | RTLD_GLOBAL);
+	unmetafy(buf, NULL);
+	if (*buf) /* dlopen(NULL) returns a handle to the main binary */
+	    ret = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
     }
 
     return ret;