diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-06-26 21:13:36 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-06-26 21:13:36 +0200 |
commit | 33ee8036099114e5c13ff44ba89a915f13922e59 (patch) | |
tree | 1e3b12108c4bebb7f2f7b2e81ce12c5f54d871c1 /src | |
parent | 1d6714e42820e837d18e46a7b6d9c25902e0193b (diff) | |
download | weechat-33ee8036099114e5c13ff44ba89a915f13922e59.zip |
core: send command line parameter to plugins only if the name starts with the plugin name followed by a colon
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/plugin.c | 9 |
1 files changed, 6 insertions, 3 deletions
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]; } |