From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Mrzyglod Subject: [PATCH v2] cfgfile: fix unitialised buffer Date: Mon, 29 Jun 2015 16:20:25 +0200 Message-ID: <1435587625-5096-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1435307833-7432-1-git-send-email-danielx.t.mrzyglod@intel.com> To: dev@dpdk.org Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 99E845A66 for ; Mon, 29 Jun 2015 16:21:40 +0200 (CEST) In-Reply-To: <1435307833-7432-1-git-send-email-danielx.t.mrzyglod@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Nature of the problem was not initialised buffer[256], there were probability that operation system will provide previously used memory and on special condition there were probability that string operations will work on random data that could provide unexpected program behaviour. Signed-off-by: Daniel Mrzyglod --- lib/librte_cfgfile/rte_cfgfile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index b81c273..9c85e9f 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -96,7 +96,10 @@ rte_cfgfile_load(const char *filename, int flags) int lineno = 0; struct rte_cfgfile *cfg = NULL; + memset(buffer, '\0', sizeof(buffer)); + FILE *f = fopen(filename, "r"); + if (f == NULL) return NULL; -- 2.1.0