From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 905DF1B1C9 for ; Sat, 20 Jan 2018 04:26:42 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 20 Jan 2018 05:26:41 +0200 Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx [10.12.205.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w0K3QeED015643; Sat, 20 Jan 2018 05:26:41 +0200 Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w0K3Qei8133023; Sat, 20 Jan 2018 11:26:40 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w0K3Qd6i133022; Sat, 20 Jan 2018 11:26:39 +0800 From: Xueming Li To: Olivier MATZ Cc: Xueming Li , dev@dpdk.org, Adrien Mazarguil , stable@dpdk.org Date: Sat, 20 Jan 2018 11:26:31 +0800 Message-Id: <20180120032631.132978-1-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 Subject: [dpdk-dev] [PATCH] cmdline: avoid garbage in unused fields of parsed result 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: Sat, 20 Jan 2018 03:26:42 -0000 The result buffer was not initialized before parsing, inducing garbage in unused fields or padding of the parsed structure. Initialize the result buffer each time before parsing. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Xueming Li --- lib/librte_cmdline/cmdline_parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c index c74b146fc..7f799f94d 100644 --- a/lib/librte_cmdline/cmdline_parse.c +++ b/lib/librte_cmdline/cmdline_parse.c @@ -168,6 +168,8 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf, int n = 0; struct cmdline_token_hdr token_hdr; + if (resbuf != NULL) + memset(resbuf, 0, resbuf_size); /* check if we match all tokens of inst */ while (!nb_match_token || i < nb_match_token) { token_p = get_token(inst, i); -- 2.13.3