From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allain Legacy Subject: [PATCH v3 5/6] cfgfile: increase local buffer size for max name and value Date: Tue, 28 Mar 2017 20:47:36 -0400 Message-ID: <20170329004737.44249-6-allain.legacy@windriver.com> References: <1489065060-98370-1-git-send-email-allain.legacy@windriver.com> <20170329004737.44249-1-allain.legacy@windriver.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , To: , Return-path: Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) by dpdk.org (Postfix) with ESMTP id 8192237B4 for ; Wed, 29 Mar 2017 02:47:53 +0200 (CEST) In-Reply-To: <20170329004737.44249-1-allain.legacy@windriver.com> 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 Acked-by: Keith Wiles --- 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 e4a3885b7..4ef7decb3 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -148,7 +148,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags, 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; -- 2.12.1