[Tarantool-patches] [PATCH 4/6] xlog: use PATH_MAX for filename

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Jun 19 02:14:22 MSK 2020


Hi! Thanks for the patch!

> diff --git a/src/box/xlog.c b/src/box/xlog.c
> index 8b2818326..1685a4cf7 100644
> --- a/src/box/xlog.c
> +++ b/src/box/xlog.c
> @@ -881,7 +881,9 @@ xlog_open(struct xlog *xlog, const char *name, const struct xlog_opts *opts)
>  	if (xlog_init(xlog, opts) != 0)
>  		goto err;
>  
> -	strncpy(xlog->filename, name, PATH_MAX);
> +	strncpy(xlog->filename, name, sizeof(xlog->filename));
> +	xlog->filename[sizeof(xlog->filename)-1] = '\0';

Please, use whitespaces before and after binary operations.


More information about the Tarantool-patches mailing list