1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 23:06:38 +02:00

core: properly skip command char when it is a wide char in exec of hook_command_run

This commit is contained in:
Sébastien Helleu
2023-01-29 21:20:18 +01:00
parent 2bcd9cb87b
commit 269b8fc66e
+4 -3
View File
@@ -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;
}
}