From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C413EA04BA; Wed, 7 Oct 2020 12:26:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0FEE52BC7; Wed, 7 Oct 2020 12:26:49 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 383131E34 for ; Wed, 7 Oct 2020 12:26:48 +0200 (CEST) IronPort-SDR: ZELrYoBY4qDMe+S94eVjb0NHyGcOVsMjlNePAA2lS1MefRzOIk/w7uzEUWl4bAw4UmoK4ysi2K 0UoXGYuXrApA== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="152656077" X-IronPort-AV: E=Sophos;i="5.77,346,1596524400"; d="scan'208";a="152656077" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2020 03:26:44 -0700 IronPort-SDR: Eq6yNaaxxlSfWybNnM0CaI95aHoTbdqj1E0GYX38voTTgECuIxDWCP6xXnL9Eou3W7nAewiIP3 huwhr59n+epQ== X-IronPort-AV: E=Sophos;i="5.77,346,1596524400"; d="scan'208";a="461267049" Received: from bricha3-mobl.ger.corp.intel.com ([10.213.1.245]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 07 Oct 2020 03:26:43 -0700 Date: Wed, 7 Oct 2020 11:26:38 +0100 From: Bruce Richardson To: Olivier Matz Cc: Ferruh Yigit , Ciara Loftus , dev@dpdk.org Message-ID: <20201007102638.GB680@bricha3-MOBL.ger.corp.intel.com> References: <20201007090137.5121-1-ciara.loftus@intel.com> <20201007095131.GQ21395@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201007095131.GQ21395@platinum> Subject: Re: [dpdk-dev] [PATCH] net/af_xdp: use snprintf instead of strncpy X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Oct 07, 2020 at 11:51:31AM +0200, Olivier Matz wrote: > On Wed, Oct 07, 2020 at 10:40:32AM +0100, Ferruh Yigit wrote: > > On 10/7/2020 10:01 AM, Ciara Loftus wrote: > > > strncpy may leave the destination buffer not NULL terminated so use > > > snprintf instead. > > > > What do you think using 'strlcpy'? > > Or even better, rte_strscpy() > https://git.dpdk.org/dpdk/commit/?id=b0236c7cf761 > I think this is largely a matter of preference, and unless there is a good reason not to, I tend towards strlcpy as the older and more common (till now) interface. The main thing is just to use a function that will guarantee dest is null-terminated here, and both strlcpy and strscpy meet that criteria. /Bruce