From 6017ce464d9e53506500ef0219fd5b5b3f84d4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Mon, 6 Feb 2017 20:11:29 +0100 Subject: [PATCH] WebSocket: fix showing the close reason --- json-rpc-shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json-rpc-shell.c b/json-rpc-shell.c index 09c4d82..9b5c4f7 100644 --- a/json-rpc-shell.c +++ b/json-rpc-shell.c @@ -1909,7 +1909,7 @@ backend_ws_finish_closing_handshake } char *s = iconv_xstrdup (self->ctx->term_from_utf8, - reason.str, reason.len, NULL); + reason.str, reason.len + 1 /* null byte */, NULL); print_status ("server closed the connection (%s)", s); str_free (&reason); free (s); @@ -2932,7 +2932,7 @@ make_json_rpc_call (struct app_context *ctx, if (!success) { char *s = iconv_xstrdup (ctx->term_from_utf8, - buf.str, buf.len + 1, NULL); + buf.str, buf.len + 1 /* null byte */, NULL); if (!s) print_error ("character conversion failed for `%s'", "raw response data");