[vlc-commits] modules: remove special case for module names starting with $

Rémi Denis-Courmont git at videolan.org
Tue Jan 30 20:45:23 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jan 30 21:20:51 2018 +0200| [dfd480edafee4c4ce842baf5eb253aa897c56eb2] | committer: Rémi Denis-Courmont

modules: remove special case for module names starting with $

Resolving the variable internally was a nice hack when using a string
literal. But it becomes a source of problems when a user-contrlled
variable is used already, as $ could be injected unexpectedly.

Also incidentally fix a leak when no module match a capability.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dfd480edafee4c4ce842baf5eb253aa897c56eb2
---

 src/modules/modules.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/src/modules/modules.c b/src/modules/modules.c
index fcbf3f9984..65b71376b4 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -217,18 +217,9 @@ module_t *vlc_module_load(vlc_object_t *obj, const char *capability,
                           const char *name, bool strict,
                           vlc_activate_t probe, ...)
 {
-    char *var = NULL;
-
     if (name == NULL || name[0] == '\0')
         name = "any";
 
-    /* Deal with variables */
-    if (name[0] == '$')
-    {
-        var = var_InheritString (obj, name + 1);
-        name = (var != NULL) ? var : "any";
-    }
-
     /* Find matching modules */
     module_t **mods;
     ssize_t total = module_list_cap (&mods, capability);
@@ -305,7 +296,6 @@ done:
     va_end (args);
     obj->obj.force = b_force_backup;
     module_list_free (mods);
-    free (var);
 
     if (module != NULL)
     {



More information about the vlc-commits mailing list