diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index a716e0091..579ba5dfb 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -15,6 +15,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 0.4.4 (under dev) +* core: add missing \0 at the end of stderr buffer in hook_process * core: fix detection of terminated process in hook_process * core: set option weechat.look.buffer_search_where to prefix_message by default * core: fix "/window scroll -N" on a buffer with free content diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 415879530..0334464f3 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -1607,15 +1607,15 @@ hook_process_child (struct t_hook *hook_process) void hook_process_send_buffers (struct t_hook *hook_process, int callback_rc) { - int i, size; + int size; /* add '\0' at end of stdout and stderr */ - for (i = 0; i < 2; i++) - { - size = HOOK_PROCESS(hook_process, buffer_size[i]); - if (size > 0) - HOOK_PROCESS(hook_process, buffer[i])[size] = '\0'; - } + size = HOOK_PROCESS(hook_process, buffer_size[HOOK_PROCESS_STDOUT]); + if (size > 0) + HOOK_PROCESS(hook_process, buffer[HOOK_PROCESS_STDOUT])[size] = '\0'; + size = HOOK_PROCESS(hook_process, buffer_size[HOOK_PROCESS_STDERR]); + if (size > 0) + HOOK_PROCESS(hook_process, buffer[HOOK_PROCESS_STDERR])[size] = '\0'; /* send buffers to callback */ (void) (HOOK_PROCESS(hook_process, callback))