summaryrefslogtreecommitdiff
path: root/src/plugins/perl
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-12-29 09:25:56 +0100
committerSébastien Helleu <flashcode@flashtux.org>2018-01-06 14:07:44 +0100
commitb80e3ff7928df5ba52ba1f40d52c7964286c41ef (patch)
treeb66fc5c11deb5f5a888989509f43c54908ba4da6 /src/plugins/perl
parent414959a474eb80d917e384147c95fe1ea35b8e62 (diff)
downloadweechat-b80e3ff7928df5ba52ba1f40d52c7964286c41ef.zip
perl: do not update message argument in function weechat_perl_output (issue #128)
Diffstat (limited to 'src/plugins/perl')
-rw-r--r--src/plugins/perl/weechat-perl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c
index 31671d8ab..9ad5e0a16 100644
--- a/src/plugins/perl/weechat-perl.c
+++ b/src/plugins/perl/weechat-perl.c
@@ -278,7 +278,7 @@ weechat_perl_output_flush ()
XS (weechat_perl_output)
{
- char *msg, *ptr_msg, *ptr_newline;
+ char *msg, *ptr_msg, *ptr_newline, *message;
dXSARGS;
if (items < 1)
@@ -288,10 +288,11 @@ XS (weechat_perl_output)
ptr_msg = msg;
while ((ptr_newline = strchr (ptr_msg, '\n')) != NULL)
{
- ptr_newline[0] = '\0';
- weechat_string_dyn_concat (perl_buffer_output, ptr_msg);
+ message = weechat_strndup (ptr_msg, ptr_newline - ptr_msg);
+ weechat_string_dyn_concat (perl_buffer_output, message);
+ if (message)
+ free (message);
weechat_perl_output_flush ();
- ptr_newline[0] = '\n';
ptr_msg = ++ptr_newline;
}
weechat_string_dyn_concat (perl_buffer_output, ptr_msg);