From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 510811B163; Thu, 14 Feb 2019 10:31:20 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 01:31:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,368,1544515200"; d="scan'208";a="144191952" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga004.fm.intel.com with ESMTP; 14 Feb 2019 01:31:17 -0800 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x1E9VGtL022873; Thu, 14 Feb 2019 09:31:16 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x1E9Uedr032742; Thu, 14 Feb 2019 09:30:40 GMT Received: (from tchaitax@localhost) by wgcvswdev001.ir.intel.com with œ id x1E9Uedu032738; Thu, 14 Feb 2019 09:30:40 GMT From: Chaitanya Babu Talluri To: dev@dpdk.org Cc: reshma.pattan@intel.com , cristian.dumitrescu@intel.com, jananeex.m.parthasarathy@intel.com, Chaitanya Babu Talluri , stable@dpdk.org Date: Thu, 14 Feb 2019 09:30:31 +0000 Message-Id: <1550136631-32415-1-git-send-email-tallurix.chaitanya.babu@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: Subject: [dpdk-dev] [PATCH] lib: fix strcat with equivalent logic 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: Thu, 14 Feb 2019 09:31:20 -0000 Replace strcat with concatenation logic to avoid buffer overflow. Fixes: a6a47ac9c2 ("cfgfile: rework load function") Cc: stable@dpdk.org Signed-off-by: Chaitanya Babu Talluri --- lib/librte_cfgfile/rte_cfgfile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index 7d8c941ea..7616742f7 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -227,7 +227,15 @@ rte_cfgfile_load_with_params(const char *filename, int flags, while (end != NULL) { if (*(end+1) == params->comment_character) { *end = '\0'; - strcat(split[1], end+1); + int index = strlen(split[1]); + char *temp = end+1; + while (*temp != '\0') { + split[1][index] = *temp; + index++; + temp++; + } + split[1][index] = '\0'; + } else end++; end = memchr(end, '\\', strlen(end)); -- 2.17.2