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 CC94AC3F8 for ; Mon, 29 Jun 2015 17:08:24 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 29 Jun 2015 08:07:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,699,1427785200"; d="scan'208";a="755195115" Received: from unknown ([10.217.248.46]) by orsmga002.jf.intel.com with SMTP; 29 Jun 2015 08:07:21 -0700 Received: by (sSMTP sendmail emulation); Mon, 29 Jun 2015 17:06:16 +0200 From: Daniel Mrzyglod To: dev@dpdk.org Date: Mon, 29 Jun 2015 17:06:03 +0200 Message-Id: <1435590363-4656-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435307833-7432-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1435307833-7432-1-git-send-email-danielx.t.mrzyglod@intel.com> Subject: [dpdk-dev] [PATCH v3] cfgfile: fix unitialised buffer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2015 15:08:25 -0000 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. Changes in v3: -Simplify the initialization of buffer. Changes in v2: -Found the real nature of problem. Only buffer was not initilized. Changes in v1: -Add additional separate IO buffer and initialize both buffers. Signed-off-by: Daniel Mrzyglod --- 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 b81c273..a677dad 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -92,7 +92,7 @@ rte_cfgfile_load(const char *filename, int flags) int allocated_entries = 0; int curr_section = -1; int curr_entry = -1; - char buffer[256]; + char buffer[256] = {0}; int lineno = 0; struct rte_cfgfile *cfg = NULL; -- 2.1.0