From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id A3621B464 for ; Wed, 11 May 2016 07:28:27 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 10 May 2016 22:28:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,607,1455004800"; d="scan'208";a="700271526" Received: from ziyeyang-mobl2.ccr.corp.intel.com (HELO localhost.localdomain.localdomain) ([10.239.201.36]) by FMSMGA003.fm.intel.com with ESMTP; 10 May 2016 22:28:25 -0700 From: Ziye Yang To: dev@dpdk.org Date: Wed, 11 May 2016 13:28:21 +0800 Message-Id: <1462944501-15852-1-git-send-email-ziye.yang@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dpdk-dev] [PATCH] librte_eal: fix wrong args operation in eal_parse_args 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: Wed, 11 May 2016 05:28:28 -0000 This patch is used to fix wrong operation on user input args. eal_parse_args function should not operate the args passed by the user. If the element in argv is generated by malloc function, changing it will cause memory issues when free the args. Signed-off-by: Ziye Yang --- lib/librte_eal/bsdapp/eal/eal.c | 2 -- lib/librte_eal/linuxapp/eal/eal.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 06bfd4e..0eef92d 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -420,8 +420,6 @@ eal_parse_args(int argc, char **argv) goto out; } - if (optind >= 0) - argv[optind-1] = prgname; ret = optind-1; out: diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 8aafd51..ba9d1ac 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -658,8 +658,6 @@ eal_parse_args(int argc, char **argv) goto out; } - if (optind >= 0) - argv[optind-1] = prgname; ret = optind-1; out: -- 1.9.3