From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 86964A49A; Tue, 20 Feb 2018 14:29:19 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2018 05:29:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,539,1511856000"; d="scan'208";a="28489781" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.77]) by FMSMGA003.fm.intel.com with SMTP; 20 Feb 2018 05:29:16 -0800 Received: by (sSMTP sendmail emulation); Tue, 20 Feb 2018 13:29:15 +0000 Date: Tue, 20 Feb 2018 13:29:14 +0000 From: Bruce Richardson To: Radu Nicolau Cc: dev@dpdk.org, john.mcnamara@intel.com, maryam.tahhan@intel.com, reshma.pattan@intel.com, stable@dpdk.org Message-ID: <20180220132914.GA10780@bricha3-MOBL3.ger.corp.intel.com> References: <1519131456-9928-1-git-send-email-radu.nicolau@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519131456-9928-1-git-send-email-radu.nicolau@intel.com> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.1 (2017-09-22) Subject: Re: [dpdk-dev] [PATCH] app/procinfo: fix strncpy count issue 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: , X-List-Received-Date: Tue, 20 Feb 2018 13:29:20 -0000 On Tue, Feb 20, 2018 at 12:57:36PM +0000, Radu Nicolau wrote: > Change strncpy count parameter to MAX_LONG_OPT_SZ-1 to avoid > overwriting the last NULL character and for consistency. > > Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id") > Coverity issue: 30688 > > Cc: stable@dpdk.org > > Signed-off-by: Radu Nicolau > --- strncpy is a very nasty function that is easy to get wrong. Rather than fixing it's off by one errors, I think a better fix is to use snprintf as is done in most other places. /Bruce