Christian Brabandt wrote:
> Bram,
> I see a segfault on Windows, when running the test_channel.vim test.
>
> If I understand the code correctly, this happens because FormatMessage()
> fails and therefore the msgbuf is NULL. In that case, the following for
> loop tries to dereference the null pointer and therefore segfaults.
>
> I have not checked, why FormatMessage() fails, but the test runs
> successfully afterwards. I think, this happens in Test_out_close_cb(),
> but I am not sure.
>
> Here is a patch:
>
> diff -r 405c0bba9d1d src/channel.c
> --- a/src/channel.c Wed Jun 15 22:15:07 2016 +0200
> +++ b/src/channel.c Wed Jun 22 19:55:07 2016 +0200
> @@ -273,7 +273,7 @@
> 0,
> NULL);
> /* chomp \r or \n */
> - for (ptr = (char_u *)msgbuf; *ptr; ptr++)
> + for (ptr = (char_u *)msgbuf; ptr != NULL && *ptr; ptr++)
> switch (*ptr)
> {
> case '\r':
OK, but then the function would still return NULL and pass that to
emsg3(). Oh, vim_snprintf() takes care of that.
--
Birthdays are healthy. The more you have them, the longer you live.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.