diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 6cb19c26b..1e95cc2c8 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -26,6 +26,7 @@ New features:: Bug fixes:: + * core: send command line parameter to plugins only if the name starts with the plugin name followed by a colon * core: auto disable upgrade process (command line option "--upgrade") if the file weechat.upgrade is not found * core: replace newlines by spaces in argument "completion" of function hook_command (issue #538) * core: replace char "," by "~" in color codes to separate foreground from background (issue #1264) diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 2f2304f6a..a11e87612 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -273,12 +273,14 @@ plugin_get_args (struct t_weechat_plugin *plugin, int argc, char **argv, int *plugin_argc, char ***plugin_argv) { - int i, temp_argc; + int i, temp_argc, length_plugin_name; char **temp_argv; temp_argc = 0; temp_argv = NULL; + length_plugin_name = strlen (plugin->name); + if (argc > 0) { temp_argv = malloc ((argc + 1) * sizeof (*temp_argv)); @@ -290,8 +292,9 @@ plugin_get_args (struct t_weechat_plugin *plugin, || (strcmp (argv[i], "--no-connect") == 0) || (strcmp (argv[i], "-s") == 0) || (strcmp (argv[i], "--no-script") == 0) - || (strncmp (argv[i], plugin->name, - strlen (plugin->name)) == 0)) + || ((strncmp (argv[i], plugin->name, + length_plugin_name) == 0) + && (argv[i][length_plugin_name] == ':'))) { temp_argv[temp_argc++] = argv[i]; }