From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0CB2A41C5DA for ; Fri, 19 Jun 2020 10:19:47 +0300 (MSK) Received: by mail-lj1-f193.google.com with SMTP id e4so10306675ljn.4 for ; Fri, 19 Jun 2020 00:19:47 -0700 (PDT) Date: Fri, 19 Jun 2020 10:19:44 +0300 From: Cyrill Gorcunov Message-ID: <20200619071944.GS134822@grain> References: <20200617220335.836265-1-gorcunov@gmail.com> <20200617220335.836265-5-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH 4/6] xlog: use PATH_MAX for filename List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tml , Alexander Turenko 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!