diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-29 21:20:18 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-29 21:20:18 +0100 |
commit | 269b8fc66e45edb02a58bbee5d4c510873e53951 (patch) | |
tree | 9db427c3fa45b44cbe945c359bee7769c9f4064a /src/core/hook/wee-hook-command-run.c | |
parent | 2bcd9cb87b25a3db7ca30b4f87b06ae68ece6d23 (diff) | |
download | weechat-269b8fc66e45edb02a58bbee5d4c510873e53951.zip |
core: properly skip command char when it is a wide char in exec of hook_command_run
Diffstat (limited to 'src/core/hook/wee-hook-command-run.c')
-rw-r--r-- | src/core/hook/wee-hook-command-run.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/hook/wee-hook-command-run.c b/src/core/hook/wee-hook-command-run.c index 9eb3b183e..7d95d8042 100644 --- a/src/core/hook/wee-hook-command-run.c +++ b/src/core/hook/wee-hook-command-run.c @@ -103,7 +103,7 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command) struct t_hook *ptr_hook, *next_hook; int rc, hook_matching, length; char *command2; - const char *ptr_command; + const char *ptr_string, *ptr_command; if (!weechat_hooks[HOOK_TYPE_COMMAND_RUN]) return WEECHAT_RC_OK; @@ -113,11 +113,12 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command) if (command[0] != '/') { - length = strlen (command) + 1; + ptr_string = utf8_next_char (command); + length = 1 + strlen (ptr_string) + 1; command2 = malloc (length); if (command2) { - snprintf (command2, length, "/%s", command + 1); + snprintf (command2, length, "/%s", ptr_string); ptr_command = command2; } } |