From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 917BB28947 for ; Mon, 20 Aug 2018 16:50:56 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K53V_hjWZOVY for ; Mon, 20 Aug 2018 16:50:56 -0400 (EDT) Received: from smtp62.i.mail.ru (smtp62.i.mail.ru [217.69.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id D17EE28928 for ; Mon, 20 Aug 2018 16:50:55 -0400 (EDT) Date: Mon, 20 Aug 2018 23:50:50 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH] box: fix long uri output in box.info() Message-ID: <20180820205050.GB32353@chai> References: <20180820180806.97866-1-sergepetrenko@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180820180806.97866-1-sergepetrenko@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Serge Petrenko * Serge Petrenko [18/08/20 21:24]: > lua_pushapplier() had an inexplicably small buffer for uri > representation. Enlarged the buffer. > > Closes #3630 Hi, Thanks for finding this. But the trouble is not only with the small buffer, but also with incorrect termination of a possibly multi-byte string in case of truncation. Could you please add a unit test for uri_format which fixes this? Thanks. > --- > https://github.com/tarantool/tarantool/issues/3630 > https://github.com/tarantool/tarantool/tree/sp/gh-3630-long-uri-fix > > src/box/lua/info.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/box/lua/info.c b/src/box/lua/info.c > index d6697df9c..970c80c99 100644 > --- a/src/box/lua/info.c > +++ b/src/box/lua/info.c > @@ -95,7 +95,7 @@ lbox_pushapplier(lua_State *L, struct applier *applier) > applier->last_row_time); > lua_settable(L, -3); > > - char name[FIBER_NAME_MAX]; > + char name[APPLIER_SOURCE_MAXLEN]; > int total = uri_format(name, sizeof(name), &applier->uri, false); > > lua_pushstring(L, "peer"); > -- > 2.15.2 (Apple Git-101.1) > > -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov