From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id DEF6B2B8B for ; Thu, 1 Feb 2018 10:48:09 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 968A5209CA; Thu, 1 Feb 2018 04:48:09 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 01 Feb 2018 04:48:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Qwf/CR8DGlYbpVmbj 4lGMKbiFF5t7tZTgugvakiufaM=; b=pZPioD4hj9aXMFUoE5mut7BZ3AWwbfslJ 1W94yIyiatsEX2dlw/pYRqWX4FKaTVlhgNbOy/KZGRXYVD+N3BRBmPxD1J3M7szd /Lh0piz6EP5re2p6uRtFjjRSYnBO9a7ea6qUJSSIFsJuKkkbYGXclLPpfkj++GNs 4W6Z0KkQ2ZeOy6ZlRjiYM+RPyU1RrMze19qG6WGqh5hMs60YIP9gg9Fl9M3yWOI+ Ugp5tGuxVBaIToe9Hw7aR+lxG3F1NwDvYFUTepkw+//kRAH0cVCaWTBzfpWSq614 YU5a8up21MOvWhAFtUjNJAtPp5RX8z+l0VjcywQvE5Y0y4Z+XYXCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=Qwf/CR8DGlYbpVmbj4lGMKbiFF5t7tZTgugvakiufaM=; b=jTV+NUi/ aZ1KJsE0mx7TIjn2KCyhzO1a10S+4IigkSG+ed5SD3WhKhYXKOOJHC3CCIP71Rym Klhi3nUEIjgQyEjgY4k1CG6VSHpQyugO/mqHtTpGMPYR2ov8eU3pqN+Gg7pOvn2L F6GVkBT7m1aB2Gr2Z+RVZ0z8GFB4RLRBVLS6mRmxGI7EnKiFHPay2U6kyNHwyJr6 v1V+962xrCHiZIdOzphPPcCbJLjKOU4N0dofTXLPOvBaRs2ct4sYjj3KGFEuFR3e zSYNznTAkSgfXlJ/YEdzjkE/1VKX8XjYWcuofnJsVs2ZHqBFAzGWTZnihEIjYnnV aqmMN6COX/ZKBg== X-ME-Sender: Received: from yliu-mob.mtl.com (unknown [115.150.27.200]) by mail.messagingengine.com (Postfix) with ESMTPA id AFFA924724; Thu, 1 Feb 2018 04:48:07 -0500 (EST) From: Yuanhan Liu To: Xueming Li Cc: Olivier Matz , dpdk stable Date: Thu, 1 Feb 2018 17:47:17 +0800 Message-Id: <1517478479-12417-3-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> References: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'cmdline: fix dynamic tokens parsing' has been queued to LTS release 17.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 09:48:10 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/03/18. So please shout if anyone has objections. Thanks. --yliu --- >>From abab0573ee5b94cc97501134d355d3dc6b03f23a Mon Sep 17 00:00:00 2001 From: Xueming Li Date: Sat, 20 Jan 2018 02:16:10 +0800 Subject: [PATCH] cmdline: fix dynamic tokens parsing [ upstream commit 2acf7432ad3e67f676d7d14a6acc3b90a2d9117e ] When using dynamic tokens, the result buffer contains pointers to some location inside the result buffer. When the content of the temporary buffer is copied in the final one, these pointers still point to the temporary buffer. This works until the temporary buffer is kept intact, but the next commit introduces a memset() that breaks this assumption. This commit keeps the successfully parsed buffers, and ensures that the pointers point to the valid location, by using temp buffer for following parsing. Fixes: 9b3fbb051d2e ("cmdline: fix parsing") Signed-off-by: Xueming Li Acked-by: Olivier Matz --- lib/librte_cmdline/cmdline_parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c index 3e12ee5..c74b146 100644 --- a/lib/librte_cmdline/cmdline_parse.c +++ b/lib/librte_cmdline/cmdline_parse.c @@ -263,6 +263,7 @@ cmdline_parse(struct cmdline *cl, const char * buf) #ifdef RTE_LIBRTE_CMDLINE_DEBUG char debug_buf[BUFSIZ]; #endif + char *result_buf = result.buf; if (!cl || !buf) return CMDLINE_PARSE_BAD_ARGS; @@ -312,16 +313,14 @@ cmdline_parse(struct cmdline *cl, const char * buf) debug_printf("INST %d\n", inst_num); /* fully parsed */ - tok = match_inst(inst, buf, 0, tmp_result.buf, - sizeof(tmp_result.buf)); + tok = match_inst(inst, buf, 0, result_buf, + CMDLINE_PARSE_RESULT_BUFSIZE); if (tok > 0) /* we matched at least one token */ err = CMDLINE_PARSE_BAD_ARGS; else if (!tok) { debug_printf("INST fully parsed\n"); - memcpy(&result, &tmp_result, - sizeof(result)); /* skip spaces */ while (isblank2(*curbuf)) { curbuf++; @@ -332,6 +331,7 @@ cmdline_parse(struct cmdline *cl, const char * buf) if (!f) { memcpy(&f, &inst->f, sizeof(f)); memcpy(&data, &inst->data, sizeof(data)); + result_buf = tmp_result.buf; } else { /* more than 1 inst matches */ -- 2.7.4