From 77cefb762157eed61e7e1982de91e03d39e976a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 31 May 2017 19:51:57 +0200 Subject: [PATCH] core: limit hook_command_run to the exact given command (when no "*" are in command hook) --- src/core/wee-hook.c | 9 ++++++--- 1 file 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)