diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-05-31 19:51:57 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-06-25 16:35:27 +0200 |
commit | 77cefb762157eed61e7e1982de91e03d39e976a6 (patch) | |
tree | 6cf561542c15e7fe920a4e050a80c506f270bfc6 | |
parent | dc60f343badd8abb93fa8082924cf0fd6e1ce1df (diff) | |
download | weechat-77cefb762157eed61e7e1982de91e03d39e976a6.zip |
core: limit hook_command_run to the exact given command (when no "*" are in command hook)
-rw-r--r-- | src/core/wee-hook.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 277f75388..e3f617444 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -1013,9 +1013,12 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command) if (!hook_matching && !strchr (HOOK_COMMAND_RUN(ptr_hook, command), ' ')) { - hook_matching = (string_strncasecmp (ptr_command, - HOOK_COMMAND_RUN(ptr_hook, command), - utf8_strlen (HOOK_COMMAND_RUN(ptr_hook, command))) == 0); + length = strlen (HOOK_COMMAND_RUN(ptr_hook, command)); + hook_matching = ((string_strncasecmp (ptr_command, + HOOK_COMMAND_RUN(ptr_hook, command), + utf8_strlen (HOOK_COMMAND_RUN(ptr_hook, command))) == 0) + && ((ptr_command[length] == ' ') + || (ptr_command[length] == '\0'))); } if (hook_matching) |