[tarantool-patches] Re: [PATCH] box: fix long uri output in box.info()

Konstantin Osipov kostja at tarantool.org
Mon Aug 20 23:50:50 MSK 2018


* Serge Petrenko <sergepetrenko at tarantool.org> [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




More information about the Tarantool-patches mailing list