From patchwork Thu Mar 9 13:10:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allain Legacy X-Patchwork-Id: 21636 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 3F6ADD08E; Thu, 9 Mar 2017 14:12:13 +0100 (CET) Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) by dpdk.org (Postfix) with ESMTP id A5EDD37B4 for ; Thu, 9 Mar 2017 14:11:34 +0100 (CET) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id v29DBXlB017415 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 9 Mar 2017 05:11:33 -0800 (PST) Received: from yow-cgts4-lx.wrs.com (128.224.145.137) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 9 Mar 2017 05:11:33 -0800 From: Allain Legacy To: , CC: , Date: Thu, 9 Mar 2017 08:10:59 -0500 Message-ID: <1489065060-98370-6-git-send-email-allain.legacy@windriver.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489065060-98370-1-git-send-email-allain.legacy@windriver.com> References: <1488482971-170522-1-git-send-email-allain.legacy@windriver.com> <1489065060-98370-1-git-send-email-allain.legacy@windriver.com> MIME-Version: 1.0 X-Originating-IP: [128.224.145.137] Subject: [dpdk-dev] [PATCH v2 5/6] cfgfile: increase local buffer size for max name and value 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" From: Joseph Richard When parsing a ini file with a "key = value" line that has both "key" and "value" sized to the maximum allowed length causes a parsing failure. The internal "buffer" variable should be sized at least as large as the maximum for both fields. This commit updates the local array to be sized to hold the max name, max value, " = ", and the nul terminator. Signed-off-by: Allain Legacy --- lib/librte_cfgfile/rte_cfgfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index 416b3b6..35c81e4 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -112,7 +112,7 @@ struct rte_cfgfile * int allocated_entries = 0; int curr_section = -1; int curr_entry = -1; - char buffer[256] = {0}; + char buffer[CFG_NAME_LEN + CFG_VALUE_LEN + 4] = {0}; int lineno = 0; struct rte_cfgfile *cfg = NULL;