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

Cyrill Gorcunov gorcunov at gmail.com
Fri Jun 19 10:19:44 MSK 2020


On Fri, Jun 19, 2020 at 01:14:22AM +0200, Vladislav Shpilevoy wrote:
> > --- 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.

I could argue that this -1 is not a regular binop taking account
the context of the operation but sure, updated and pushed out.
Thanks!


More information about the Tarantool-patches mailing list