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 7BA0A2E41; Tue, 20 Feb 2018 14:05:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2018 05:05:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,539,1511856000"; d="scan'208";a="202419560" Received: from silpixa00383879.ir.intel.com (HELO silpixa00383879.ger.corp.intel.com) ([10.237.223.127]) by orsmga005.jf.intel.com with ESMTP; 20 Feb 2018 05:05:34 -0800 From: Radu Nicolau To: dev@dpdk.org Cc: john.mcnamara@intel.com, maryam.tahhan@intel.com, reshma.pattan@intel.com, Radu Nicolau , stable@dpdk.org Date: Tue, 20 Feb 2018 13:00:21 +0000 Message-Id: <1519131621-10053-1-git-send-email-radu.nicolau@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1519131456-9928-1-git-send-email-radu.nicolau@intel.com> References: <1519131456-9928-1-git-send-email-radu.nicolau@intel.com> Subject: [dpdk-stable] [PATCH v2] app/procinfo: fix strncpy count issue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 13:05:38 -0000 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: 143252 Cc: stable@dpdk.org Signed-off-by: Radu Nicolau --- v2: corrected coverity issue id app/proc_info/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 2f53e3c..5f0b745 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c @@ -159,7 +159,7 @@ proc_info_preparse_args(int argc, char **argv) proc_info_usage(prgname); return -1; } - strncpy(host_id, argv[i+1], sizeof(host_id)); + strncpy(host_id, argv[i+1], MAX_LONG_OPT_SZ-1); } } -- 2.7.5